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
Format errors as JSON-API #46
Conversation
case vfs.ErrIllegalFilename: | ||
return InvalidParameter("folder-id", err) | ||
case vfs.ErrInvalidHash: | ||
return InvalidParameter("Content-MD5", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really an InvalidParameter
or StatusUnprocessableEntity 422
(the MD5 given has the good "format") but a StatusPreconditionFailed 412
(the MD5 calculated does not match the given one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark for ErrContentLengthMismatch
which can fall into the same category.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I'm going to fix that!
@nono no |
@jinroh errors in |
I am OK to merge this PR as is, but in the future think we should have a similar structure for error handling in both CRUD and VFS api. In CRUD, I opted to use the gin error handling mechanism, with the combo
In VFS, you went with having a In the future we could A. switch to echo v3, where we simply return error and then have an error handling function wich does all the triaging/formating.
my 2c |
Rebased and merged 226e75a |
@aenario @jinroh I'm working on JSON-API formatting. This PR is not yet ready to be merged, but you may want to look at it to see where I'm goingIt's now ready!