]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Better error handling when updating Facebook
authorZach Copley <zach@controlyourself.ca>
Mon, 27 Jul 2009 02:54:51 +0000 (02:54 +0000)
committerZach Copley <zach@controlyourself.ca>
Mon, 27 Jul 2009 02:54:51 +0000 (02:54 +0000)
lib/facebookutil.php
lib/mail.php

index 85077c254ae1dbee2f50b846f07e342d1d264326..b7688f04f00c51e1641f2efa397d9267e743dfa5 100644 (file)
@@ -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).");
index 262f788ee5f3ce387ab096c8d477695fd6ca9017..0050ad8104b2ba4935166fa582a7d29f19b4a7b4 100644 (file)
@@ -679,17 +679,17 @@ function mail_facebook_app_removed($user)
     $site_name = common_config('site', 'name');
 
     $subject = sprintf(
-        _('Your %s Facebook application access has been disabled.',
+        _('Your %1\$s Facebook application access has been disabled.',
             $site_name));
 
     $body = sprintf(_("Hi, %1\$s. We're sorry to inform you that we are " .
-        'unable to update your Facebook status from %s, and have disabled ' .
+        'unable to update your Facebook status from %2\$s, and have disabled ' .
         'the Facebook application for your account. This may be because ' .
         'you have removed the Facebook application\'s authorization, or ' .
         'have deleted your Facebook account.  You can re-enable the ' .
         'Facebook application and automatic status updating by ' .
-        "re-installing the %1\$s Facebook application.\n\nRegards,\n\n%1\$s"),
-        $site_name);
+        "re-installing the %2\$s Facebook application.\n\nRegards,\n\n%2\$s"),
+        $user->nickname, $site_name);
 
     common_init_locale();
     return mail_to_user($user, $subject, $body);