From d4698db76752bf5dbb5c82934f06dedc71a04d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 16 Apr 2021 19:00:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Route/Node.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 419ee2cd..e245df26 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -541,12 +541,15 @@ class Node extends HttpService } if (!$validator->validation()) { - return Json::to(401, $validator->getError()); + return Json::to(5005, $validator->getError()); } return $this->runWith(...func_get_args()); } catch (Throwable $throwable) { $this->addError($throwable, 'throwable'); - return Json::to(401, $throwable->getMessage()); + + $code = $throwable->getCode() == 0 ? 500 : $throwable->getCode(); + + return Json::to($code, $throwable->getMessage()); } }