Closed killua-eu closed 2 years ago
In slim 4, the default error middleware will handle each exception in the related exception handler. These exception handlers were pre-defined in the slim. like:
But, In the whoops error handler, All exception will handle by one exception handler. this exception handler cannot identify which case should be handled.
Back to your case, I think you should need to create a custom handler for whoops. also, the whoops handler should be used in development mode maybe better
On some routes, I rethrow exceptions to achieve a better user experience. When using the standard Slim 4 error middleware, the thrown ErrorException will by default generate a 500 response. When the ErrorException gets re-thrown as a HttpNotFoundException, I get a 404 error (expected behaviour). When I use php-slim-whoops, I get 500 on ErrorException (expected) but also a 500 when rethrown as HttpNotFoundException (should be 404). Am I doing something wrong or is this a bug? Example code below.
Throw an ErrorException
Rethrow it