return correct HTTP status code for OMB errors

This commit is contained in:
Evan Prodromou 2010-03-01 15:31:20 -05:00
parent 1414b6b849
commit c7d8641e7d
2 changed files with 16 additions and 0 deletions

View 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;

View 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;