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
HTTP status codes review #106
Comments
The possible error codes have been documented in this commit. |
The best way to provide the right status code is to know what actually happened. Currently, the database engine works like this: callback(false, data); // On success
callback(true); // On error, the second parameter being undefined or null A good way to provide explicit errors to the callback would be to use integers. It is how most programs work, even the HTTP codes in fact. callback(0, data); // On success, as 0 evaluates to false it is compatible with existing code
callback(n, details); // On error, n being a code and details debug information In order not to duplicate code in every database function, we could provide a self.sendCode(err, data, callback); // "err" being the error provided by the database driver The question is, what codes should we call the callback with?
We could cheat by having our own status codes coincide with the HTTP statuses, with the "0" exception to tell that everything worked fine instead of 2xx statuses. It is just another way to present the first solution. |
Thank you for this enlightenment. It will be important to finegrain the returned errors at one point, certainly when the number of features will increase. For now I would keep it for later since we have other important subjects to adress |
The API reference on the wiki has been updated by @gnoxr but it doesn't seem to be finished and there is no syntax rule at all. Il could be easier to define a way of writing HTTP statuses on wiki and by extension every command |
yes the description of the http queries and responses in the wiki page could be updated in a nicer normalized way. (My bad, that i didn't write it well the first time ;) we could use the syntax used for the create, read and update operations which is nicest. I reopen |
About the wiki documentation, I wanted to raise the point that the miscellaneous HTTP status codes are not shown outside of the libraries. What do you think? |
I agree. This totally make sense. I update the issue description |
The HTTP status codes are now described in the Contributing page under the «Protocol Specifications» chapter. closing this issue. |
review the HTTP status codes used by the operations of our RESTful server.
@gnoxr
The text was updated successfully, but these errors were encountered: