Commit 71b06653 authored by Thomas's avatar Thomas
Browse files

Fix issue #2 - Blank page when an error occurred

parent 553ce7ea
...@@ -146,8 +146,12 @@ class Mastodon_api { ...@@ -146,8 +146,12 @@ class Mastodon_api {
$response = wp_remote_post( $url, $parameters ); $response = wp_remote_post( $url, $parameters );
}else }else
$response = wp_remote_get( $url, $parameters ); $response = wp_remote_get( $url, $parameters );
$data['html'] = json_decode($response['body'], true); if( is_wp_error($response)){
$data['response'] = json_decode($response['body'], true); $data['error'] = $response->get_error_message();
}else{
$data['html'] = json_decode($response['body'], true);
$data['response'] = json_decode($response['body'], true);
}
return $data; return $data;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment