From: Zach Copley Date: Thu, 29 Oct 2009 00:29:21 +0000 (-0700) Subject: Trap ClientExceptions from media upload process and hand them off to API error handler X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=03a1436a1c07c0867ca748560b37457f99ea1d66;p=quix0rs-gnu-social.git Trap ClientExceptions from media upload process and hand them off to API error handler --- diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 3a030f0fe8..898a4bd723 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -192,7 +192,13 @@ class ApiStatusesUpdateAction extends ApiAuthAction } $upload = null; - $upload = MediaFile::fromUpload('media', $this->user); + + try { + $upload = MediaFile::fromUpload('media', $this->user); + } catch (ClientException $ce) { + $this->clientError($ce->getMessage()); + return; + } if (isset($upload)) { $status_shortened .= ' ' . $upload->shortUrl();