I am registering a custom error handler:
$errorMiddleware = $app->addErrorMiddleware(false, false, false);
$errorHandler = $errorMiddleware->getDefaultErrorHandler();
$errorHandler->registerErrorRenderer('text/html', MyCustomErrorRenderer::class);
And I have a custom 404 handler:
class CustomNotFoundErrorRenderer extends HttpSpecializedException {
...
}
But when I do
throw new CustomNotFoundErrorRenderer($request);
my 404 class does not work, but outputs what it returns MyCustomErrorRenderer.
I’m already confused about who intercepts when and what. I need my own error handler and my own 404 page. Please help me.