From 9b4ee9070467eb5df02b350e2e3d01a2c2497836 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 1 Mar 2010 15:31:20 -0500 Subject: [PATCH] return correct HTTP status code for OMB errors --- actions/postnotice.php | 8 ++++++++ actions/updateprofile.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/actions/postnotice.php b/actions/postnotice.php index f092d54d1d..ad3f00e349 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 dfc31f5427..44fafdd926 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; -- 2.39.5