PHP error handling best approach?

Hi PHP Programmers,

Anyone, please post your opinions regarding, what is the best approach to handle errors? I will post mine first,

I use PDO as the database handler, whenever an error occurs I call my custom made method which will implode the errorInfo() output in a nice way with current page’s URL and timestamp and display the output, this output is also sent the admin’s email address, finally, just after the output I have used exit() so nothing is displayed.

What are your opinions regarding the above approach?

Many Thanks and happy posting opinions :):cool:

what types of errors are you logging? In most cases it would probably be preferable to display some output to the user, or redirect to a static html error page.

Also, what happens if the database is the point of failure?

If the database fails, the default PDOException will be displayed and emailed to the admin.