Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code固定为-32000 #8

Open
jcleng opened this issue Jun 20, 2022 · 0 comments
Open

code固定为-32000 #8

jcleng opened this issue Jun 20, 2022 · 0 comments

Comments

@jcleng
Copy link

jcleng commented Jun 20, 2022

$response = $this->responseBuilder->buildErrorResponse($request, ResponseBuilder::SERVER_ERROR, $exception);

可以这个位置修改成统一的格式吗,而且code固定为SERVER_ERROR了,可以交给用户抛出的code吗,在异常app\Exception\Handler\里面也无法修改响应格式

{
  "code": -32000,
  "message": "No query results for model xx.",
  "data": {
    "class": "Hyperf\\Database\\Model\\ModelNotFoundException",
    "code": 0,
    "message": "No query results for model xx."
  }
}

{
    "code": 200,
    "data": {
      "no": "12345678"
    },
    "message": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant