Add exceptions from frontend
This commit is contained in:
parent
c61a9e0c5b
commit
7e35a39cf5
21
exceptions/generic/MDAccessDeniedException.php
Normal file
21
exceptions/generic/MDAccessDeniedException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
21
exceptions/generic/MDConfigCannotBeLoadedException.php
Normal file
21
exceptions/generic/MDConfigCannotBeLoadedException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
22
exceptions/generic/MDmainEntityNotExistentException.php
Normal file
22
exceptions/generic/MDmainEntityNotExistentException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
22
exceptions/generic/MDpageParameterNotFromListException.php
Normal file
22
exceptions/generic/MDpageParameterNotFromListException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
22
exceptions/page/MDPageNotInAggregatedException.php
Normal file
22
exceptions/page/MDPageNotInAggregatedException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
22
exceptions/page/MDmainEntityNotPublicException.php
Normal file
22
exceptions/page/MDmainEntityNotPublicException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
21
exceptions/page/MDpageParameterMissingException.php
Normal file
21
exceptions/page/MDpageParameterMissingException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
21
exceptions/page/MDpageParameterNotNumericException.php
Normal file
21
exceptions/page/MDpageParameterNotNumericException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
22
exceptions/updates/MDFileUploadNotAcceptedException.php
Normal file
22
exceptions/updates/MDFileUploadNotAcceptedException.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
29
exceptions/updates/MDInvalidLicense.php
Normal file
29
exceptions/updates/MDInvalidLicense.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user