snytkine / LampCMS

Open source Question and Answer program similar to StackOverflow and Quora in PHP + MongoDB. Follow @snytkine on Twitter
http://support.lampcms.com
323 stars 104 forks source link

Centralize error handler and exception handler #83

Closed snytkine closed 12 years ago

snytkine commented 12 years ago

Create a new file errorHandler.php place in the Lampcms dir Require this file from !inc.php It will have ErrorHandler function and ExceptionHandler function then it will register these functions as default error handler and default exception handler

Then try to do away with the try/catch block in index.php and have the default exception handler catch all uncaught exceptions and email admin on errors.

Inside ExceptionHandler always try to use Mailer class first inside try/catch the inside the catch block fallback to mail() function.

This way we can still attempt to use SwiftMailer for error emails but it that does not work then fallback to php's mail()

snytkine commented 12 years ago

Current error handler was modified. Major rewrite is not necessary for this release may revisit this possibility in some future releases.