Welcome Guest, Not a member yet? Register   Sign In
Custom 500 error page

(This post was last modified: 02-08-2022, 07:10 AM by sjender.)

Another day, another question  Big Grin.

I have my own custom 404 page set with: 
PHP Code:

However, now I want to do the same with the 500 (Whoops we seem to have hit a snag) error.
I don't want to edit the default file, I need to have it pointed to 'App\Controllers\Errors:: show500'.
Can someone point me in the right direction?

Just override Services::exceptions() to return your class that extends CodeIgniter\Debug\Exceptions.
It's simple ))))))

Wel,, that's in the system folder right?
I prefer not to edit stuff there.
I would like not to edit this every time I update CI.
Isn't there a way outside the system folder?


I've never done this before.
But are you saying I should overide the entire Exceptions class?
The only method that I seem to need to edit is determineView().

How is this done?

I don't know what you want.
You said you don't want to change the default file.
Therefore, I would venture to suggest that you want to change some kind of logic.
Here is a class with logic for you)

Why don't you create app/Views/errors/html/error_500.php ?

Because I would like to have different views depending on various situations.

Therefore I need to be able to change determination of the view file.
Just like I did with the 404 file

Theme © iAndrew 2016 - Forum software by © MyBB