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

Error Definition #1

Open
uier opened this issue Feb 5, 2022 · 1 comment
Open

Error Definition #1

uier opened this issue Feb 5, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@uier
Copy link
Contributor

uier commented Feb 5, 2022

需要定義 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 內就可以了?

@uier uier added the documentation Improvements or additions to documentation label Feb 5, 2022
@uier
Copy link
Contributor Author

uier commented Feb 5, 2022

待後端確認完每個 endpoint 所有可能的 error 後再更新

@skyhong2002 skyhong2002 moved this to 📋 Backlog in UniCourse Roadmap Oct 14, 2022
@skyhong2002 skyhong2002 moved this from 📋 Backlog to 💬 Discussing in UniCourse Roadmap Nov 2, 2022
@skyhong2002 skyhong2002 moved this from 💬 Discussing to 📋 Backlog in UniCourse Roadmap Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant