From febf7d9982ceca0b2d0c1d0598bd3222a8d5566c Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 6 Oct 2021 20:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bootstrap/HttpErrorHandler.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bootstrap/HttpErrorHandler.php b/bootstrap/HttpErrorHandler.php index dd8fd8af..4d5cf821 100644 --- a/bootstrap/HttpErrorHandler.php +++ b/bootstrap/HttpErrorHandler.php @@ -127,6 +127,13 @@ class HttpErrorHandler extends Injectable { $errors = require config_path('errors.php'); + /** + * 向外隐藏具体的500异常信息 + */ + if ($this->response->getStatusCode() == 500) { + $code = 'sys.internal_server_error'; + } + return [ 'code' => $code, 'msg' => $errors[$code] ?? $code,