summaryrefslogtreecommitdiff
path: root/lib/facebookutil.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-07-27 02:54:51 +0000
committerZach Copley <zach@controlyourself.ca>2009-07-27 02:54:51 +0000
commitb9cf19a2ee4b483709f1e964860fcf9209c4ba05 (patch)
tree17c4833e227976ac816ff1bfda3ee560ba57d9e5 /lib/facebookutil.php
parent3077876b1706222385182cb2647f9f5a99d6dffd (diff)
Better error handling when updating Facebook
Diffstat (limited to 'lib/facebookutil.php')
-rw-r--r--lib/facebookutil.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/facebookutil.php b/lib/facebookutil.php
index 85077c254..b7688f04f 100644
--- a/lib/facebookutil.php
+++ b/lib/facebookutil.php
@@ -193,14 +193,16 @@ function facebookBroadcastNotice($notice)
$facebook->api_client->users_setStatus($status, $fbuid, false, true);
}
} catch(FacebookRestClientException $e) {
- common_log(LOG_ERR, $e->getMessage());
+
+ $code = $e->getCode();
+
+ common_log(LOG_ERR, 'Facebook returned error code ' .
+ $code . ': ' . $e->getMessage());
common_log(LOG_ERR,
'Unable to update Facebook status for ' .
"$user->nickname (user id: $user->id)!");
- $code = $e->getCode();
-
- if ($code >= 200) {
+ if ($code == 200 || $code == 250) {
// 200 The application does not have permission to operate on the passed in uid parameter.
// 250 Updating status requires the extended permission status_update or publish_stream.
@@ -216,7 +218,8 @@ function facebookBroadcastNotice($notice)
try {
updateProfileBox($facebook, $flink, $notice);
} catch(FacebookRestClientException $e) {
- common_log(LOG_WARNING, $e->getMessage());
+ common_log(LOG_ERR, 'Facebook returned error code ' .
+ $e->getCode() . ': ' . $e->getMessage());
common_log(LOG_WARNING,
'Unable to update Facebook profile box for ' .
"$user->nickname (user id: $user->id).");