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:
parent
83914e7601
commit
23019a31c1
1 changed files with 8 additions and 4 deletions
|
@ -15,9 +15,13 @@ class Category {
|
|||
$this->vars['permalink'] = DOMAIN_CATEGORIES . $key;
|
||||
$this->vars['list'] = $categories->db[$key]['list'];
|
||||
} else {
|
||||
$errorMessage = 'Category not found in database by key ['.$key.']';
|
||||
Log::set(__METHOD__.LOG_SEP.$errorMessage);
|
||||
throw new Exception($errorMessage);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,4 +79,4 @@ class Category {
|
|||
|
||||
return json_encode($tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue