API - handle any exceptions thrown during notice save. The API was

occasionally spitting out HTML, which is hard for clients to deal
with.
This commit is contained in:
Zach Copley 2010-03-18 15:26:13 -07:00
parent c09db79b95
commit e10d023d03
1 changed files with 11 additions and 5 deletions

View File

@ -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);