-
-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Hi! I also really hate Laravel's native exception handler.
Laravel Nova contain AuthenticationException
with render
method https://gist.github.com/4n70w4/3e17c2df500527be3f603c32ab7e2762
Switching to this library completely breaks the work of the Nova.
Also I found ~ 3 500 similar exceptions with render
method on github.
All of them will not rendered correctly when using this library.
I know that you are extremely against the changes in the method \GrahamCampbell\Exceptions\ExceptionHandler::render
However, the easiest way is to make this change.
Replace
$response = $e instanceof Responsable ? $e->toResponse($request) : null;
to
if (method_exists($e, 'render') && $response = $e->render($request)) {
$response = $this->container->get(Router::class)->toResponse($request, $response);
} elseif ($e instanceof Responsable) {
$response = $e->toResponse($request);
} else {
$response = null;
}
Alternatively, can make a separate displayer for this. My example implementation: https://gist.github.com/4n70w4/39cc0441eea9c6b94512ff2443009bf8
This is a very common scenario. I don't understand why it is not included in this library.
Switching to this library breaks some components. It is sad.
Many people will have to do the same job over and over to solve this problem.