]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Trap ClientExceptions from media upload process and hand them off to API error handler
authorZach Copley <zach@status.net>
Thu, 29 Oct 2009 00:29:21 +0000 (17:29 -0700)
committerZach Copley <zach@status.net>
Thu, 29 Oct 2009 00:29:21 +0000 (17:29 -0700)
actions/apistatusesupdate.php

index 3a030f0fe851423bd04211a157302aa9668f03e4..898a4bd723cef157ad3e768096ac5c1134db62ce 100644 (file)
@@ -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();