Decoding the error from an api duplicate status update?
I'm having a problem with processing the error caught when posting a
duplicate status...
try {
$twitter->post_statusesUpdate(array('status' => $tweet));
} catch (EpiTwitterForbiddenException $e) {
$msg = json_decode($e->getMessage());
//wp_die('Error: ' . $msg . ''); // Server errors out
wp_die('Error: ' . $e . ''); // Returns code in lower segment
if ($msg->error != 'Status is a duplicate.') {
//throw $e; // Disabled to prevent
}
}
The first wp_die errors out and the server crashes The second wp_die returns:
Exception 'EpiTwitterForbiddenException' with message
'{"errors":[{"code":187,"message":"Status is a duplicate"}]}' in
/home5/site/public_html/wp-content/plugins/download/libs/api/EpiTwitter.php:265
Stack trace: #0
/home5/site/public_html/wp-content/plugins/download/libs/api/EpiTwitter.php(226):
EpiTwitterException::raise(Object(EpiCurlManager), false) #1
/home5/site/public_html/wp-content/plugins/download/libs/api/EpiTwitter.php(127):
EpiTwitterJson->__get('response') #2
/home5/site/public_html/wp-content/plugins/download/libs/api/EpiTwitter.php(109):
EpiTwitter->request('POST', '/statuses/updat...', Array) #3
/home5/site/public_html/wp-content/plugins/download/download.php(109):
EpiTwitter->__call('post_statusesUp...', Array) #4
/home5/site/public_html/wp-content/plugins/download/download.php(109):
EpiTwitter->post_statusesUpdate(Array) #5 {main}
How am I supposed to decode that to get the error from within it?
No comments:
Post a Comment