I have a Yii2 application created using Basic Application Template. In web.php I require a file called params.php is present. To manage that, I use file exists function:
if(file_exists(__DIR__ . '/params.php')) {
$params = require __DIR__ . '/params.php';
}
I would like to throw an Exception so I can show Yii error / debug page. I have tried:
if(file_exists(__DIR__ . '/params.php')) {
$params = require __DIR__ . '/params.php';
} else {
throw new Exception("Error", 1000);
}
But Yii2 Error handler does not catch it, I am not sure if at this point is already available. Is there another way to show it on any of those pages?