diff options
author | Brion Vibber <brion@status.net> | 2010-11-19 15:51:08 -0800 |
---|---|---|
committer | Brion Vibber <brion@status.net> | 2010-11-19 15:51:08 -0800 |
commit | 94f2f96f2ebe8d7b127ec643f84cbfb20f4bb475 (patch) | |
tree | 44b81cb7bb5ad5f4fca6cee6bcc396e16b4e6397 | |
parent | 4193a826d3500c1c8771e2a55ca197011fe637c8 (diff) |
Ticket #2724: gracefully handle attempts to delete or fave/unfave a remote Twitter notice if a failure occurs.
Most annoying error case being where the notice was already faved or deleted on Twitter! :)
Such errors will now just fail out and log a note to the syslog -- the rest of what we were doing will continue on unhindered, so you can still delete, favorite, etc and it just won't sync the info over in that case.
-rw-r--r-- | plugins/TwitterBridge/TwitterBridgePlugin.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php index 097d4486f..b520a4544 100644 --- a/plugins/TwitterBridge/TwitterBridgePlugin.php +++ b/plugins/TwitterBridge/TwitterBridgePlugin.php @@ -427,10 +427,14 @@ class TwitterBridgePlugin extends Plugin return true; } - $token = TwitterOAuthClient::unpackToken($flink->credentials); - $client = new TwitterOAuthClient($token->key, $token->secret); + try { + $token = TwitterOAuthClient::unpackToken($flink->credentials); + $client = new TwitterOAuthClient($token->key, $token->secret); - $client->statusesDestroy($n2s->status_id); + $client->statusesDestroy($n2s->status_id); + } catch (Exception $e) { + common_log(LOG_ERR, "Error attempting to delete bridged notice from Twitter: " . $e->getMessage()); + } $n2s->delete(); } @@ -464,10 +468,14 @@ class TwitterBridgePlugin extends Plugin return true; } - $token = TwitterOAuthClient::unpackToken($flink->credentials); - $client = new TwitterOAuthClient($token->key, $token->secret); + try { + $token = TwitterOAuthClient::unpackToken($flink->credentials); + $client = new TwitterOAuthClient($token->key, $token->secret); - $client->favoritesCreate($status_id); + $client->favoritesCreate($status_id); + } catch (Exception $e) { + common_log(LOG_ERR, "Error attempting to favorite bridged notice on Twitter: " . $e->getMessage()); + } return true; } @@ -500,10 +508,14 @@ class TwitterBridgePlugin extends Plugin return true; } - $token = TwitterOAuthClient::unpackToken($flink->credentials); - $client = new TwitterOAuthClient($token->key, $token->secret); + try { + $token = TwitterOAuthClient::unpackToken($flink->credentials); + $client = new TwitterOAuthClient($token->key, $token->secret); - $client->favoritesDestroy($status_id); + $client->favoritesDestroy($status_id); + } catch (Exception $e) { + common_log(LOG_ERR, "Error attempting to unfavorite bridged notice on Twitter: " . $e->getMessage()); + } return true; } |