return null的时候在ExceptionHandler的render方法中,抛出的实例不是BaseException的实例,打断点看是ErrorException,我换成了ErrorException可以进去了,帮忙看下是为什么?
public function render(Exception $e)
{
if ($e instanceof ErrorException)
{
// 如果是自定义的异常
$this->code = 111;
$this->msg = '2222';
$this->errorCode = '40002';
}
else{
$this->code = 500;
$this->msg = '服务器内部错误';
$this->errorCode = 999;
}
$request = Request::instance();
$result = [
'msg' => $this->msg,
'error_code' => $this->errorCode,
'request_url' => $request->url()
];
return json($result, $this->code);
}