I want to show a custom blade page for all the 500 errors in my app.
All the solutions that I found are not working anymore on Laravel 9.
public function render($request, Exception $exception) {
}
All the solutions require to add a render method to Handler class which uses Exception $exception but unfortunately, Laravel 9 now shows an error "Method 'App\Exceptions\Handler::render()' is not compatible with method 'Illuminate\Foundation\Exceptions\Handler::render()'"
@danishiqbal4 Ah so it's a package, is it abandoned? If so why don't you fork it and make the changes needed to make it work with Laravel 9, and if it's not abandoned then you should create a issue or a PR on the package to fix the problem. It's not a good idea to supress a 500 error. Not to mention, you should never ever let the users know that you have a 500 error, it's better to just System has encountered an error and it has been reported
or somesuch.
@Sinnbeck Yes, I have the exact same file and I want to show custom page for any 500 error that will show on my app. The laravel docs say that we should add custom 500.blade.php file in resources/views/error folder but it does not work.
@Tray2 No, it's not a package. I think you did not understand my question.
I just want to show custom page for any 500 error that will show on my app. The laravel docs say that we should add custom 500.blade.php file in resources/views/error folder but it does not work.
@danishiqbal4 That is a very bad practice in my opinion. If something goes wrong it should be logged, and not shown to the user, ever. A generic message that something went wrong is much better, but best is to make sure it never happens. You obviously have something wrong in your code, fix that instead of trying to display a 500 error gracefully.