Answer the question
In order to leave comments, you need to log in
Catching all errors in yii2?
How to make it so that the function is executed after each try catch Exception and without it, so that I can log this error.
Answer the question
In order to leave comments, you need to log in
In the controller action, add a try...catch block.
try {
// ... какие то действия
} catch (\Throwable $e) {
// ... тут функция логгирования ошибки
var_dump($e); // <= просто для примера
// ну и дальше, если нужно чтобы ошибка не просто "проглатывалась" и никуда не выводилась
// можно выбросить её
throw $e;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question