From 40cbf77db9687fd556a1e0e993389f23e841a1bf Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sat, 25 Jul 2020 23:44:44 +0200 Subject: [PATCH] Add exceptions from nodac --- .../generic/MDaccessDeniedException.php | 22 +++++++++++++++ .../MDgenericInvalidInputsException.php | 22 +++++++++++++++ exceptions/generic/MDhttpFailedException.php | 22 +++++++++++++++ .../updates/MDNoUpdateVarSetException.php | 22 +++++++++++++++ .../updates/MDTooManyFilesUploadException.php | 28 +++++++++++++++++++ exceptions/updates/MDWrongFileType.php | 28 +++++++++++++++++++ .../updates/MDcouldNotSaveException.php | 22 +++++++++++++++ exceptions/updates/MDcouldNotSetPublic.php | 23 +++++++++++++++ 8 files changed, 189 insertions(+) create mode 100644 exceptions/generic/MDaccessDeniedException.php create mode 100644 exceptions/generic/MDgenericInvalidInputsException.php create mode 100644 exceptions/generic/MDhttpFailedException.php create mode 100644 exceptions/updates/MDNoUpdateVarSetException.php create mode 100644 exceptions/updates/MDTooManyFilesUploadException.php create mode 100644 exceptions/updates/MDWrongFileType.php create mode 100644 exceptions/updates/MDcouldNotSaveException.php create mode 100644 exceptions/updates/MDcouldNotSetPublic.php diff --git a/exceptions/generic/MDaccessDeniedException.php b/exceptions/generic/MDaccessDeniedException.php new file mode 100644 index 0000000..6f70162 --- /dev/null +++ b/exceptions/generic/MDaccessDeniedException.php @@ -0,0 +1,22 @@ + + */ +declare(strict_types = 1); + +/** + * Custom exception class for wrongly used files. + */ +class MDTooManyFilesUploadException extends Exception { + + /** + * Error message. + * + * @return string + */ + public function errorMessage() { + //error message + $errorMsg = 'This file\'s extension or mimetype is incorrect: ' . $this->getMessage(); + return $errorMsg; + + } + +} diff --git a/exceptions/updates/MDWrongFileType.php b/exceptions/updates/MDWrongFileType.php new file mode 100644 index 0000000..38a4049 --- /dev/null +++ b/exceptions/updates/MDWrongFileType.php @@ -0,0 +1,28 @@ + + */ +declare(strict_types = 1); + +/** + * Custom exception class for wrongly used files. + */ +class MDWrongFileType extends Exception { + + /** + * Error message. + * + * @return string + */ + public function errorMessage() { + //error message + $errorMsg = 'This file\'s extension or mimetype is incorrect: ' . $this->getMessage(); + return $errorMsg; + + } + +} diff --git a/exceptions/updates/MDcouldNotSaveException.php b/exceptions/updates/MDcouldNotSaveException.php new file mode 100644 index 0000000..9c086fc --- /dev/null +++ b/exceptions/updates/MDcouldNotSaveException.php @@ -0,0 +1,22 @@ +