Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Handling Uncaught Exceptions

Why Write Exception Handlers?

We wrote 20 lines of code in this lesson for the custom exception handler to tell us the same thing the default error handler told us. Why bother?

1 Answer

Glenré Charl Labuschagné
Glenré Charl Labuschagné
23,204 Points

Exception handlers are most useful when your code is deployed to a production server where display errors should be switched 'Off'. This allows you to customize how your application handle errors in the event that something goes wrong, especially where things are out of your control like a server error of some sort.