CodeIgniter Forums
How do I create a global error handler? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How do I create a global error handler? (/showthread.php?tid=3486)



How do I create a global error handler? - El Forum - 10-04-2007

[eluser]Unknown[/eluser]
I want to make sure that if there are any exceptions generated in my Code Igniter site, that the end user sees a "friendly" error page, but also, I want to capture the errors details and email them to myself.

For example, imagine my code tries to do a divide by zero, I want to capture that error message, mail it to me (the developer), and then finally, display a template that says to the end user "Oops, we're sorry but something bad happened."

How do I do this? I found the information about how to manually announce an error with show_error('message'), but I just want the framework to deal with any unhandled error in a global generic way.

Thank you,
Jon


How do I create a global error handler? - El Forum - 10-05-2007

[eluser]Derek Allard[/eluser]
Take a quick read through Error Handling in CodeIgniter.