Add exceptions for invalid weight and length units

This commit is contained in:
Joshua Ramon Enslin 2020-08-06 11:34:33 +02:00 committed by Stefan Rohde-Enslin
parent ac9cda19fc
commit 7ed9502290
4 changed files with 60 additions and 1 deletions

View File

@ -38,6 +38,7 @@ class MDErrorReporter {
|| $exception instanceof MDPageNotInAggregatedException
|| $exception instanceof MDWrongFileType
|| $exception instanceof MDTooManyFilesUploadException
|| $exception instanceof MDgenericInvalidInputsException
|| $exception instanceof MDExpectedException
|| $exception instanceof MDMysqliExpectedError
) {

View File

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

View File

@ -12,7 +12,7 @@ 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 {
class MDInvalidLicense extends MDgenericInvalidInputsException {
/**
* Error message.

View File

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