Fresh PHP news, tutorials, tips and much more

How turn errors to exeptions

Two days ago Stefan Priebsch posted php tip how to turn php errors to exceptions for easier debugging of code.

In a discussion at the PHP Unconference in Hamburg this weekend, the question of how to handle catchable fatal errors came up again. While I would personally prefer an exception to be thrown in the first place, it is pretty easy to convert errors to exceptions in PHP.

Stefan shows simple example how you can turn errors to exeptions with some code tuning. It is very intresting solution for better coding.

Post tagged with: , ,

Leave a Reply