Created
August 7, 2017 18:29
-
-
Save synsh/4f6cd4e57f8f57aab76a53024dbd09fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*============================================================================== | |
* Register the error handler | |
*/ | |
$whoops = new \Whoops\Run; | |
if ($environment !== 'production') { | |
// show errors for cool kids | |
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler); | |
// log exception | |
$whoops->pushHandler(function($exception, $inspector, $run){ | |
global $log; | |
$log->error('whoop - ' . $exception->getMessage()); | |
}); | |
} else { | |
// friendly error page for user | |
$whoops->pushHandler(function($e){ | |
echo 'Message : ' . $e->getMessage(); | |
}); | |
// log exception | |
$whoops->pushHandler(function($exception, $inspector, $run){ | |
global $log; | |
$log->error('whoop - ' . $exception->getMessage()); | |
}); | |
} | |
$whoops->register(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment