-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: improved error responses #59
Conversation
This removes reliance on HTTP semantics and switches to a generic Error object with mandatory 'reason' string and optional 'details'. Every endpoint now has two response types: success and error, and success has the name of returned object in its description, making the spec docs easier to read.
This looks good to me! |
Only thing that springs to mind here is that sometimes the http infrastructure hosting the pinning service API may kick out a different 4XX or 5XX error code before the application server running the API gets chance to respond, clients should probably make sure they handle a variety of regular http errors along side the errors returned from IPFS itself. |
I think the change to the error response is good, but I don't think we should be getting rid of the other http status codes. At the very least we should retain the 500 response. Having each of the 400 codes we've already added helps to clarify the category of error that should be expected when implementing/using this api. |
@lidel I agree with @jacobheun on this one. I think it would be beneficial to maintain the original 400-500 error codes that we had before. The only changes I think that are needed is just the actual error object that's returned |
This is a good base to continue, but also an application will handle a variety of 200, 400 & 500 for specific errors ans responses so client can be very informative about it. |
Thank you for feedback!
Q: is generic |
I think adding the additional 4XX for other errors would be useful. To me this implies that while we've documented common errors you might see, the API may still return other errors, such as 405 which we haven't covered. Should these also be required to return the same error object format as the other, defined 4xx codes? I'm leaning yes, but am somewhat concerned about adding an early restriction on this for code ranges. |
Added As for suggesting specific response format for The problematic one may be |
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 PR:
removes reliance on HTTP semantics for error codes and switches to a generic
HTTP 400
withError
object in body that is returned with mandatoryreason
string and optionaldetails
, as proposed in Suggestion for error code to be switch to a string #57Every endpoint now has only two response types: success and error, and success has the name of returned object in its description, making the spec docs easier to read:
PREVIEW: https://ipfs.github.io/pinning-services-api-spec/#specUrl=https://raw.githubusercontent.com/ipfs/pinning-services-api-spec/feat/error-codes/ipfs-pinning-service.yaml
Closes #57 @obo20 @andrew @GregTheGreek @priom @jsign @sanderpick @andrewxhill @ipfs/wg-pinning-services
Please provide feedback (even if its just 👍 / 👎)