Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created November 14, 2013 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phalcon/7472788 to your computer and use it in GitHub Desktop.
Save phalcon/7472788 to your computer and use it in GitHub Desktop.
<?php
set_exception_handler(function($e) use ($di) {
file_put_contents(APP_PATH . '/app/logs/error-log' . uniqid("", true) . '.txt' ,
$e->getMessage() . PHP_EOL .
print_r($e->getTrace(), true) . PHP_EOL .
print_r($_POST, true) . PHP_EOL .
print_r($_GET, true) . PHP_EOL .
print_r($_SERVER, true)
);
if ($e instanceof Phalcon\Mvc\Dispatcher\Exception) {
header('Location: ' . $di->getUrl()->get('404'));
} else {
header('Location: ' . $di->getUrl()->get('500'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment