Add a return false if category doesn't exist

If DEBUG_MODE is off, exception is not throw. False is returned instead.
This commit is contained in:
jerrywham 2021-12-20 15:06:37 +00:00 committed by GitHub
parent 83914e7601
commit 23019a31c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,11 @@ class Category {
} else {
$errorMessage = 'Category not found in database by key ['.$key.']';
Log::set(__METHOD__.LOG_SEP.$errorMessage);
if (DEBUG_MODE === true) {
throw new Exception($errorMessage);
} else {
return false;
}
}
}