Add exceptions from frontend

This commit is contained in:
Joshua Ramon Enslin 2020-07-25 23:35:38 +02:00 committed by Stefan Rohde-Enslin
parent c61a9e0c5b
commit 7e35a39cf5
10 changed files with 223 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<?PHP
declare(strict_types = 1);
/**
* Custom exception class for invalid page parameters.
*/
class MDAccessDeniedException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Parameter: <b>' . $this->getMessage() . '</b> is not a valid, numeric values.';
return $errorMsg;
}
}

View File

@ -0,0 +1,21 @@
<?PHP
declare(strict_types = 1);
/**
* Custom exception class for errors loading configuration information.
*/
class MDConfigCannotBeLoadedException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Could not connect to databse. Please try again later.';
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 MDmainEntityNotExistentException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Could not connect to databse. Please try again later.';
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 MDpageParameterNotFromListException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Invalid parameter: <b>' . $this->getMessage() . '</b>.';
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 MDPageNotInAggregatedException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'There is no entity to be shown here (id: <b>' . $this->getMessage() . '</b>).';
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 MDmainEntityNotPublicException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'There is no entity to be shown here (id: <b>' . $this->getMessage() . '</b>).';
return $errorMsg;
}
}

View File

@ -0,0 +1,21 @@
<?PHP
declare(strict_types = 1);
/**
* Custom exception class for missing page parameters.
*/
class MDpageParameterMissingException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Parameter: <b>' . $this->getMessage() . '</b> is required but missing.';
return $errorMsg;
}
}

View File

@ -0,0 +1,21 @@
<?PHP
declare(strict_types = 1);
/**
* Custom exception class for invalid page parameters.
*/
class MDpageParameterNotNumericException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'Parameter: <b>' . $this->getMessage() . '</b> is not a valid, numeric values.';
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 MDFileUploadNotAcceptedException extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = $this->getMessage();
return $errorMsg;
}
}

View File

@ -0,0 +1,29 @@
<?PHP
/**
* This file contains an exception class for usage of unaccepted licenses.
*
* @file
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Custom exception class to be raised when trying to use a license that is not
* accepted by museum-digital.
*/
class MDInvalidLicense extends Exception {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
$errorMsg = 'The following license is not available: ' . $this->getMessage();
return $errorMsg;
}
}