forked from friendica/friendica-addons
Catch Twitter Exceptions
This commit is contained in:
parent
f014d84798
commit
d032800f1e
1 changed files with 24 additions and 20 deletions
|
@ -495,6 +495,7 @@ function twitter_action(App $a, $uid, $pid, $action)
|
||||||
|
|
||||||
Logger::debug('before action', ['action' => $action, 'pid' => $pid, 'data' => $post]);
|
Logger::debug('before action', ['action' => $action, 'pid' => $pid, 'data' => $post]);
|
||||||
|
|
||||||
|
try {
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
// To-Do: $result = $connection->post('statuses/destroy', $post);
|
// To-Do: $result = $connection->post('statuses/destroy', $post);
|
||||||
|
@ -516,6 +517,9 @@ function twitter_action(App $a, $uid, $pid, $action)
|
||||||
Logger::warning('Unhandled action', ['action' => $action]);
|
Logger::warning('Unhandled action', ['action' => $action]);
|
||||||
$result = [];
|
$result = [];
|
||||||
}
|
}
|
||||||
|
} catch (TwitterOAuthException $twitterOAuthException) {
|
||||||
|
Logger::warning('Unable to communicate with twitter', ['action' => $action, 'data' => $post, 'code' => $twitterOAuthException->getCode(), 'exception' => $twitterOAuthException]);
|
||||||
|
}
|
||||||
|
|
||||||
Logger::info('after action', ['action' => $action, 'result' => $result]);
|
Logger::info('after action', ['action' => $action, 'result' => $result]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue