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

(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:
$routes->set404Override('App\Controllers\Errors::show404'); 

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?
Reply
#2

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

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?
Reply
Reply
#5

Sorry,

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?
Reply
#6

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)
Reply
#7

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

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB