]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
return correct HTTP status code for OMB errors
authorEvan Prodromou <evan@status.net>
Mon, 1 Mar 2010 20:31:20 +0000 (15:31 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 1 Mar 2010 20:31:20 +0000 (15:31 -0500)
actions/postnotice.php
actions/updateprofile.php

index f092d54d1ddf05cab5799d3245174f98cd43a6ea..ad3f00e349f8f86e549c286cca9cf3543ca6465d 100644 (file)
@@ -74,6 +74,14 @@ class PostnoticeAction extends Action
             $srv = new OMB_Service_Provider(null, omb_oauth_datastore(),
                                             omb_oauth_server());
             $srv->handlePostNotice();
+        } catch (OMB_RemoteServiceException $rse) {
+            $msg = $rse->getMessage();
+            if (preg_match('/^Revoked accesstoken/', $msg) ||
+                preg_match('/^No subscriber/', $msg)) {
+                $this->clientError($msg, 403);
+            } else {
+                $this->clientError($msg);
+            }
         } catch (Exception $e) {
             $this->serverError($e->getMessage());
             return;
index dfc31f54273e25ebb8615b7dca51de2d18bddc3c..44fafdd92605ccbdf78c5f3477934c5401ac708e 100644 (file)
@@ -77,6 +77,14 @@ class UpdateprofileAction extends Action
             $srv = new OMB_Service_Provider(null, omb_oauth_datastore(),
                                             omb_oauth_server());
             $srv->handleUpdateProfile();
+        } catch (OMB_RemoteServiceException $rse) {
+            $msg = $rse->getMessage();
+            if (preg_match('/^Revoked accesstoken/', $msg) ||
+                preg_match('/^No subscriber/', $msg)) {
+                $this->clientError($msg, 403);
+            } else {
+                $this->clientError($msg);
+            }
         } catch (Exception $e) {
             $this->serverError($e->getMessage());
             return;