You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reviewing the PR I got to thinking on whether we should change this at all.
Currently the idea is as follows:
Exceptions should not bubble out of your application they should be caught.
In production your ErrorHandler will catch all errors and handle them, but they are still errors.
Exceptions to rule 1 are specific exception classes that are explicitly thrown by the developer, children of UserException.
By passing all errors to the error handler we significantly change this behavior.
In my opinion all tests should fail if you have an error (like a TypeError) in your code. This should never ship to production.
Of course then you're left with a challenge on how to test that your error handler works as expected in cases where such a bug does end up in production. While we know that the error handler itself works it is not unreasonable to want to test your specific configuration of it.
try {
$response = $app->handleRequest($yiiRequest);
} catch (\Exception $e) { // can't catch Error and not passed to yii2 ErrorHandler processing.
}
The text was updated successfully, but these errors were encountered: