diff options
Diffstat (limited to 'application/exceptions')
-rw-r--r-- | application/exceptions/FileUploadVerifyException.php | 23 | ||||
-rw-r--r-- | application/exceptions/PublicApiException.php | 4 | ||||
-rw-r--r-- | application/exceptions/UserInputException.php | 10 |
3 files changed, 37 insertions, 0 deletions
diff --git a/application/exceptions/FileUploadVerifyException.php b/application/exceptions/FileUploadVerifyException.php new file mode 100644 index 000000000..d091c1eab --- /dev/null +++ b/application/exceptions/FileUploadVerifyException.php @@ -0,0 +1,23 @@ +<?php +/* + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ +namespace exceptions; + +class FileUploadVerifyException extends UserInputException { + public function __toString() + { + $ret = $this->getMessage()."\n"; + $data = $this->get_data(); + $errors = array(); + + foreach ($data as $error) { + $errors[] = sprintf("%s: %s", $error["filename"], $error["message"]); + } + + $ret .= implode("\n", $errors); + return $ret; + } +} diff --git a/application/exceptions/PublicApiException.php b/application/exceptions/PublicApiException.php index e7aa4360a..d22309478 100644 --- a/application/exceptions/PublicApiException.php +++ b/application/exceptions/PublicApiException.php @@ -7,4 +7,8 @@ namespace exceptions; class PublicApiException extends ApiException { + public function __toString() + { + return $this->getMessage(); + } } diff --git a/application/exceptions/UserInputException.php b/application/exceptions/UserInputException.php new file mode 100644 index 000000000..150d0204b --- /dev/null +++ b/application/exceptions/UserInputException.php @@ -0,0 +1,10 @@ +<?php +/* + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ +namespace exceptions; + +class UserInputException extends PublicApiException { +} |