noodlehaus/dispatch — pull request #53 by scan (2014-06-25 09:40:01+00:00)
Title: Replace trigger_error With Exceptions For Easier Recovery

In PHP it's not easy to recover from `trigger_error`, especially locally. I've noticed that it would be beneficial to allow the user to catch certain errors, for example when a template file is not found - to show a default page.

In general, I believe that Exceptions are much cleaner in PHP than `trigger_error`. I have decided to use the generic `ErrorException` class here, as it is built-in and denotes a fatal error like `trigger_error`, but is catchable. And it avoid defining our own `Exception` class.

However, the function `template` throws two different exceptions but with the same exception class. We should think of a solution for this, preferably without having to declare our own classes.