summaryrefslogtreecommitdiff
path: root/actions/apistatusesupdate.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-18 15:26:13 -0700
committerZach Copley <zach@status.net>2010-03-18 15:26:13 -0700
commite10d023d037ac9d2a628f8246dfccb4ad525ed59 (patch)
tree490787d2156e84056715162c39eb8e998feaadbf /actions/apistatusesupdate.php
parentc09db79b9581894b39c0368a1c36f6de16b6f0f6 (diff)
API - handle any exceptions thrown during notice save. The API was
occasionally spitting out HTML, which is hard for clients to deal with.
Diffstat (limited to 'actions/apistatusesupdate.php')
-rw-r--r--actions/apistatusesupdate.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index bf367e1e1..1956c8586 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -244,11 +244,17 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$options = array_merge($options, $locOptions);
}
- $this->notice =
- Notice::saveNew($this->auth_user->id,
- $content,
- $this->source,
- $options);
+ try {
+ $this->notice = Notice::saveNew(
+ $this->auth_user->id,
+ $content,
+ $this->source,
+ $options
+ );
+ } catch (Exception $e) {
+ $this->clientError($e->getMessage());
+ return;
+ }
if (isset($upload)) {
$upload->attachToNotice($this->notice);