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.
This commit is contained in:
Brion Vibber 2010-11-19 15:51:08 -08:00
parent 4193a826d3
commit 94f2f96f2e

View File

@ -427,10 +427,14 @@ class TwitterBridgePlugin extends Plugin
return true; return true;
} }
$token = TwitterOAuthClient::unpackToken($flink->credentials); try {
$client = new TwitterOAuthClient($token->key, $token->secret); $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(); $n2s->delete();
} }
@ -464,10 +468,14 @@ class TwitterBridgePlugin extends Plugin
return true; return true;
} }
$token = TwitterOAuthClient::unpackToken($flink->credentials); try {
$client = new TwitterOAuthClient($token->key, $token->secret); $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; return true;
} }
@ -500,10 +508,14 @@ class TwitterBridgePlugin extends Plugin
return true; return true;
} }
$token = TwitterOAuthClient::unpackToken($flink->credentials); try {
$client = new TwitterOAuthClient($token->key, $token->secret); $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; return true;
} }