Skip to content

Error Definition #1

Description

@uier

需要定義 Error Response 的 title & message

title 為 Snake Case、Uppercase 的命名,例如 "AUTH_WRONG_PASSWORD", "AUTH_USER_NOT_FOUND"
message 為開發者留下的錯誤訊息,例如錯誤的原因

前端再根據 title 去拋出對應的顯示文字給 end user 看

Response

目前的 Response (#/components/schemas/Response) 同時有 data 與 err,實際上應該成功的時候才有 data、失敗時才有 err?

{
  "success": true,
  "data": "string",
  "err": {
    "title": "string",
    "message": "string"
  },
  "token": "string"
}

例如

200 登入成功

{
  "success": true,
  "data": {
    "token": "string"
  }
}

401 登入失敗

{
  "success": false,
  "err": {
    "title": "AUTH_WRONG_PASSWORD",
    "message": "Provided password is incorrect."
  }
}

additional token property

續簽的 token 是否放在 data 內就可以了?

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions