update
This commit is contained in:
@@ -32,25 +32,21 @@ class GatewayExceptionHandler extends ExceptionHandler
|
||||
$this->stopPropagation(); // 阻止异常冒泡
|
||||
$traceId = $this->getTraceId();
|
||||
|
||||
$isError = !($throwable instanceof BusinessException)
|
||||
&& !($throwable instanceof ValidateException)
|
||||
&& !($throwable instanceof RequestException);
|
||||
|
||||
$code = 500;
|
||||
$message = '服务器内部错误';
|
||||
|
||||
if (($throwable instanceof BusinessException)) {
|
||||
$code = $throwable->getCode();
|
||||
$message = $throwable->getMessage();
|
||||
if ($isError) {
|
||||
$code = 500;
|
||||
$message = '服务器内部错误';
|
||||
} else {
|
||||
$code = $throwable->getCode() ?: 500;
|
||||
$message = $throwable->getMessage() ?: '服务异常,请稍后重试';
|
||||
$code = $throwable->getCode() ?? 500;
|
||||
$message = $throwable->getMessage() ?? '服务器内部错误';
|
||||
}
|
||||
|
||||
$request = Util::get(RequestInterface::class);
|
||||
Util::logger()
|
||||
->setErrorStatus(
|
||||
!($throwable instanceof BusinessException)
|
||||
&& !($throwable instanceof ValidateException)
|
||||
&& !($throwable instanceof RequestException)
|
||||
)
|
||||
->setErrorStatus($isError)
|
||||
->setMessage($message)
|
||||
->setThrowable($throwable)
|
||||
->setTraceId($traceId)
|
||||
|
||||
Reference in New Issue
Block a user