Add exceptions from nodac

This commit is contained in:
Joshua Ramon Enslin 2020-07-25 23:44:44 +02:00 committed by Stefan Rohde-Enslin
parent 7e35a39cf5
commit 40cbf77db9
8 changed files with 189 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case the main entity of a page (e.g. an object, an institution etc.)
* are not set public.
*/
class MDaccessDeniedException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'You have no permission to access this.';
return $errorMsg;
}
}

View File

@ -0,0 +1,22 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case the main entity of a page (e.g. an object, an institution etc.)
* are not set public.
*/
class MDgenericInvalidInputsException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Inputs are not valid.';
return $errorMsg;
}
}

View File

@ -0,0 +1,22 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case the main entity of a page (e.g. an object, an institution etc.)
* are not set public.
*/
class MDhttpFailedException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Inputs are not valid.';
return $errorMsg;
}
}

View File

@ -0,0 +1,22 @@
<?PHP
declare(strict_types = 1);
/**
* Custom exception class for invalid page parameters, which must be values of a
* preset list of allowed values.
*/
class MDNoUpdateVarSetException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'No update variable has been set.';
return $errorMsg;
}
}

View File

@ -0,0 +1,28 @@
<?PHP
/**
* This file contains an exception class for wrongly used files.
*
* @file
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
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;
}
}

View File

@ -0,0 +1,28 @@
<?PHP
/**
* This file contains an exception class for wrongly used files.
*
* @file
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
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;
}
}

View File

@ -0,0 +1,22 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case the main entity of a page (e.g. an object, an institution etc.)
* are not set public.
*/
class MDcouldNotSaveException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Could not save.';
return $errorMsg;
}
}

View File

@ -0,0 +1,23 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case the main entity of a page (e.g. an object, an institution etc.)
* are not set public.
*/
class MDcouldNotSetPublic extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Could not set this to public.';
return $errorMsg;
}
}