Closed
Bug 985919
Opened 11 years ago
Closed 11 years ago
Loop Server — Errors should be returned using a defined format
Categories
(Hello (Loop) :: Server, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: alexis+bugs, Assigned: rhubscher)
References
Details
Attachments
(1 file)
It seems to me it would be easier for the client to have a defined protocol for the errors.
For the token server, we decided to use the cornice format for the errors, and that seemed to be useful.
Basically, the top-level JSON object in the response will always contain a key named "status", which maps to a string identifying the cause of the error. Unexpected errors will have a status string of “error”; errors expected as part of the protocol flow will have a specific status.
Errors will have three different keys:
- location is the location of the error. It can be “querystring”, “header” or “body”
- name is the eventual name of the value that caused problems
- description is a description of the problem encountered.
For instance, that would be something like:
{
"status": "errors",
"errors": [{"location": "body",
"name": "version",
"description": "version should be an integer"
}]
}
Nico, Dmose, Standard8, do you think that would make sense to use a similar paradigm for the loop server?
Reporter | ||
Updated•11 years ago
|
Flags: needinfo?(standard8)
Flags: needinfo?(nperriault)
Flags: needinfo?(dmose)
LGTM
Flags: needinfo?(nperriault)
Comment 2•11 years ago
|
||
That should be fine, as long as we don't need to localise the descriptions, then it'll be good.
Flags: needinfo?(standard8)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → rhubscher
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8395651 -
Flags: review?(alexis+bugs)
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Reporter | ||
Comment 4•11 years ago
|
||
Comment on attachment 8395651 [details] [review]
Link to GitHub PR.
After discussions, makes more sense to implement this as a middleware that we can reuse easily, and that exposes an `addError` on the response object.
Attachment #8395651 -
Flags: review?(alexis+bugs) → review-
Comment 5•11 years ago
|
||
Re the format, I don't understand how the value of "name" is "version". The structure suggested looks reasonable to me at first glance, though I suspect we won't really have useful opinions until we've used it for a little while.
Flags: needinfo?(dmose)
Assignee | ||
Comment 6•11 years ago
|
||
I had a similar interogation.
Actually, the format is as follow for a 400 errors.
- location is the location where the parameter has been looked for (url, querystring, body)
- name is the variable name (version, token, callerId, user, etc)
- description is the human readable message.
This helps the client developer (Server user) to understand what is missing (Document Oriented Error Messages)
Assignee | ||
Comment 7•11 years ago
|
||
Comment on attachment 8395651 [details] [review]
Link to GitHub PR.
Updated the PR with the middleware.
Attachment #8395651 -
Flags: review- → review?(alexis+bugs)
Reporter | ||
Comment 8•11 years ago
|
||
Comment on attachment 8395651 [details] [review]
Link to GitHub PR.
That's far better but still missing some bits. Declining for now, but we're almost there :)
Attachment #8395651 -
Flags: review?(alexis+bugs) → review-
Assignee | ||
Comment 9•11 years ago
|
||
Comment on attachment 8395651 [details] [review]
Link to GitHub PR.
Fixing comments.
Attachment #8395651 -
Flags: review- → review?(alexis+bugs)
Reporter | ||
Comment 10•11 years ago
|
||
I directly addressed some of my comments and merged it, thanks!
https://github.com/mozilla-services/loop-server/commit/aa0a7ba4d450a814a521631bdbdec5da3de4246f
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•11 years ago
|
Attachment #8395651 -
Flags: review?(alexis+bugs) → review+
Comment 11•11 years ago
|
||
Closing out the older bugs. The current code is newer than this commit.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•