blessing-skin-server/app/Exceptions/ExceptionHandler.php
2016-07-22 13:48:33 +08:00

55 lines
1.3 KiB
PHP

<?php
namespace App\Exceptions;
class ExceptionHandler
{
public static function handler($e)
{
switch ($e->getCode()) {
case E_PARSE:
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_USER_ERROR:
$level = 'Fatal Error';
break;
case E_WARNING:
case E_USER_WARNING:
case E_COMPILE_WARNING:
case E_RECOVERABLE_ERROR:
$level = 'Warning';
break;
case E_NOTICE:
case E_USER_NOTICE:
$level = 'Notice';
break;
case E_STRICT:
$level = 'Strict';
break;
case E_DEPRECATED:
case E_USER_DEPRECATED:
$level = 'Deprecated';
break;
default:
$level = 'Type Unknown';
break;
}
echo \View::make('errors.exception')->with('level', $level)
->with('message', $e->getMessage())
->with('file', $e->getFile())
->with('line', $e->getLine());
exit;
}
}