diff --git a/app/Exception/ErrException.php b/app/Exception/ErrException.php index 29c039b..74d779a 100644 --- a/app/Exception/ErrException.php +++ b/app/Exception/ErrException.php @@ -2,9 +2,14 @@ namespace App\Exception; +use App\Constants\ReturnCode; use Hyperf\Server\Exception\ServerException; class ErrException extends ServerException { - + /** + * 重写抛出错误的状态码 + * @var int + */ + protected $code = ReturnCode::ERROR; } \ No newline at end of file diff --git a/app/Exception/Handler/ErrExceptionHandler.php b/app/Exception/Handler/ErrExceptionHandler.php index 862e13a..ceadcbf 100644 --- a/app/Exception/Handler/ErrExceptionHandler.php +++ b/app/Exception/Handler/ErrExceptionHandler.php @@ -2,6 +2,7 @@ namespace App\Exception\Handler; +use App\Constants\ReturnCode; use App\Exception\ErrException; use App\Lib\AdminReturn; use App\Lib\ApiReturn;