Merge pull request #1128 from nupplaphil/bug/twitter_timeout

Catch Twitter Exceptions
pull/1130/head
Michael Vogel 2021-05-29 21:27:27 +02:00 committed by GitHub
commit 050b46139b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 20 deletions

View File

@ -495,6 +495,7 @@ function twitter_action(App $a, $uid, $pid, $action)
Logger::debug('before action', ['action' => $action, 'pid' => $pid, 'data' => $post]);
try {
switch ($action) {
case 'delete':
// 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]);
$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]);
}