public static function output(Exception $error) { if (APP_DEBUG) { if (IS_AJAX) { Response::json($error->getMessage()); exit; } include Config::get('TMPL_EXCEPTION_FILE'); exit; } else { echo '程序异常,给您带来麻烦,非常抱歉!'; } exit; }
/** * 获取异常扩展信息 * 用于非调试模式html返回类型显示 * @param \Exception $exception * @return array 异常类定义的扩展数据 */ private static function getExtendData($exception) { $data = []; if ($exception instanceof Exception) { $data = $exception->getData(); } return $data; }
public function __construct($message, $code = 0, $extra = array()) { parent::__construct($message, $code); $this->extra = $extra; }