更新tp5内核
This commit is contained in:
@@ -21,11 +21,16 @@ use think\Response;
|
||||
|
||||
class Handle
|
||||
{
|
||||
|
||||
protected $render;
|
||||
protected $ignoreReport = [
|
||||
'\\think\\exception\\HttpException',
|
||||
];
|
||||
|
||||
public function setRender($render)
|
||||
{
|
||||
$this->render = $render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
@@ -52,6 +57,10 @@ class Handle
|
||||
$log = "[{$data['code']}]{$data['message']}";
|
||||
}
|
||||
|
||||
if (Config::get('record_trace')) {
|
||||
$log .= "\r\n" . $exception->getTraceAsString();
|
||||
}
|
||||
|
||||
Log::record($log, 'error');
|
||||
}
|
||||
}
|
||||
@@ -74,6 +83,13 @@ class Handle
|
||||
*/
|
||||
public function render(Exception $e)
|
||||
{
|
||||
if ($this->render && $this->render instanceof \Closure) {
|
||||
$result = call_user_func_array($this->render, [$e]);
|
||||
if ($result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if ($e instanceof HttpException) {
|
||||
return $this->renderHttpException($e);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user