Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Handling Uncaught Exceptions

Laurie Addoms
Laurie Addoms
12,398 Points

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,202 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.