Answer the question
In order to leave comments, you need to log in
How to create a single point of exception handling?
Input
- Template advance.
- Looking at the rest section (others - backend, frontend...)
How to create a single point of exception handling
i.e. so that in each action of each controller do not write a try.. catch block
try {
// блок кода
$request = Yii::$app->request->notExistedParamForException;
return ['key' => 'test'];
} catch (\Exception $e) {
// блок отлова ошибки и вывода соответствующего отображения
return $this->run('/common/error/500', ['e' => $e]);
}
$request = Yii::$app->request->notExistedParamForException;
return ['key' => 'test'];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question