-
Notifications
You must be signed in to change notification settings - Fork 33
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
Strict mode - Throw error if response isn't 2xx #75
base: master
Are you sure you want to change the base?
Conversation
EDIT: I looked more closely at how you handled the strict option. This looks like a reasonable solution to me. It should satisfy the complaints about attempting to parse JSON for non-200 responses while still providing expected behavior for those who don't have the same requirement. |
@ethanent @XuluWarrior I agree this would be a good solution. The only comment I'd have is that the user may want to be able to inspect the response, which would get lost with this solution. Adding a class that extends Error and attaches the response to it would make the response available if the user wants to inspect it. It might even be helpful to have separate |
I like the idea. And agree with @jdforsythe on separate |
I kind of put this PR down after my initial attempt worked well enough for me but I think it is still worth finishing. I agree that extending Error with a There are client errors where simply retrying later has a chance of success (e.g. |
I'd forgotten that I'd created this PR but I still believe that "strict mode" really helps streamline code that uses phin. (I'm happily using my fork for this reason) Any thoughts as whether this can be merged in some form? I'm happy to put the additional effort to address review comments. |
83e0eb2
to
a1964a7
Compare
a1964a7
to
b8538bd
Compare
No description provided.