summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-03-01 15:31:20 -0500
committerEvan Prodromou <evan@status.net>2010-03-01 18:03:18 -0500
commitc7d8641e7dcb2af0ab9ad682f64c5ebc45fbbeae (patch)
tree6efc0bdf775feda1f64dca76a9f54e1721925e66 /actions
parent1414b6b84954939b2f120443ab90a75d1ffb2a65 (diff)
return correct HTTP status code for OMB errors
Diffstat (limited to 'actions')
-rw-r--r--actions/postnotice.php8
-rw-r--r--actions/updateprofile.php8
2 files changed, 16 insertions, 0 deletions
diff --git a/actions/postnotice.php b/actions/postnotice.php
index f092d54d1..ad3f00e34 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -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;
diff --git a/actions/updateprofile.php b/actions/updateprofile.php
index dfc31f542..44fafdd92 100644
--- a/actions/updateprofile.php
+++ b/actions/updateprofile.php
@@ -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;