Consistent API error messages
@vpanjganj is already working on this.
Since Nov 22, 2018.
Assessment
This issue has not been assessed yet.
Description
Hello,
Recently we discussed in the Topcoder Community, and people have different opinions regarding errors messages.
From your best practices:
Response messages must be self-descriptive. A good error message response might look something like this:
// (1)
{
"code": 1234,
"message" : "Something bad happened",
"description" : "More details"
}
or for validation errors:
// (2)
{
"code" : 2314,
"message" : "Validation Failed",
"errors" : [
{
"code" : 1233,
"field" : "email",
"message" : "Invalid email"
},
{
"code" : 1234,
"field" : "password",
"message" : "No password provided"
}
]
}
Based on my understanding, (1) schema can be used as a general error format, and (2) schema can be used for a specific situation (validation errors in this case).
That means error responses don't have to have the exact format with the same properties.
Some developers insist that all error responses should be consistent and be the same.
Could you clarify it according to your best practices in this project?
- Dominant language
- JavaScript
- Stars
- 29.4k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elsewhencode/project-guidelines
-
AQUAEDGE PROMOTIONS Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
elsewhencode/project-guidelines#176 · 1 comment ·
-
improvement
elsewhencode/project-guidelines#160 · 3 reactions · 1 assignee ·
-
improvement
elsewhencode/project-guidelines#140 · 1 assignee ·
-
help wanted improvement
elsewhencode/project-guidelines#124 · 2 comments · 6 reactions · 1 assignee ·
-
suggestion
elsewhencode/project-guidelines#111 · 1 comment · 3 reactions · 1 assignee ·
All issues in elsewhencode/project-guidelines
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·