summaryrefslogtreecommitdiff
path: root/actions/apistatusesupdate.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-07-29 20:31:22 +0000
committerZach Copley <zach@status.net>2010-07-29 20:31:22 +0000
commit0faa988e91056564b2ae19f045a81b322cce4e0c (patch)
tree79187009708588586bc3d3c087507408b89fd822 /actions/apistatusesupdate.php
parent4e8e77f6b091e024f58241c2807c61e0b7930e5c (diff)
Fix for issue ID 2290: make sure errors are returned in the right
format, and use callback for errors when the request is JSONP
Diffstat (limited to 'actions/apistatusesupdate.php')
-rw-r--r--actions/apistatusesupdate.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index 9be16b2c5..fa3f611c0 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -196,7 +196,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->clientError(
_('This method requires a POST.'),
- 400, $this->format
+ 400,
+ $this->format
);
return;
}
@@ -217,7 +218,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
if (empty($this->status)) {
$this->clientError(
- 'Client must provide a \'status\' parameter with a value.',
+ _('Client must provide a \'status\' parameter with a value.'),
400,
$this->format
);
@@ -291,8 +292,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
try {
$upload = MediaFile::fromUpload('media', $this->auth_user);
- } catch (ClientException $ce) {
- $this->clientError($ce->getMessage());
+ } catch (Exception $e) {
+ $this->clientError($e->getMessage(), $e->getCode(), $this->format);
return;
}
@@ -305,7 +306,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction
'Max notice size is %d chars, ' .
'including attachment URL.'
);
- $this->clientError(sprintf($msg, Notice::maxContent()));
+ $this->clientError(
+ sprintf($msg, Notice::maxContent()),
+ 400,
+ $this->format
+ );
}
}
@@ -332,7 +337,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$options
);
} catch (Exception $e) {
- $this->clientError($e->getMessage(), $e->getCode());
+ $this->clientError($e->getMessage(), $e->getCode(), $this->format);
return;
}