Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2021-12-28 20:00:22 +0300
committerJulien Veyssier <eneiluj@posteo.net>2022-01-03 12:27:39 +0300
commitf65698a7f81a7afbb7848539295892b6b49a7172 (patch)
treef4437a6904f3fef4849b14760307a98d88949303 /lib
parente628527c8a913d0ec6c3fcb69955822d400cf601 (diff)
use specific exception on upload error
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/ImageController.php3
-rw-r--r--lib/UploadException.php27
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/Controller/ImageController.php b/lib/Controller/ImageController.php
index 54a10336d..200119cd4 100644
--- a/lib/Controller/ImageController.php
+++ b/lib/Controller/ImageController.php
@@ -27,6 +27,7 @@ namespace OCA\Text\Controller;
use Exception;
use OCA\Text\Service\SessionService;
+use OCA\Text\UploadException;
use OCP\AppFramework\Http;
use OCA\Text\Service\ImageService;
use OCP\AppFramework\Controller;
@@ -218,7 +219,7 @@ class ImageController extends Controller {
$error = $phpFileUploadErrors[$file['error']];
}
if ($error !== null) {
- throw new Exception($error);
+ throw new UploadException($error);
}
return $file;
}
diff --git a/lib/UploadException.php b/lib/UploadException.php
new file mode 100644
index 000000000..99ec93201
--- /dev/null
+++ b/lib/UploadException.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * @copyright Copyright (c) 2021 Julien Veyssier <eneiluj@posteo.net>
+ *
+ * @author Julien Veyssier <eneiluj@posteo.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Text;
+
+class UploadException extends \Exception {
+}