-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Improve error handling #345
Conversation
@@ -13,6 +15,8 @@ module.exports = function settle(resolve, reject, response) { | |||
if (!response.status || !validateStatus || validateStatus(response.status)) { | |||
resolve(response); | |||
} else { | |||
reject(response); | |||
var error = createError('Request failed with status code ' + response.status, response.config); | |||
error.response = response; |
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.
I would change this to pass response
in as 4th arg to createError
.
This would have required a note in the |
Breaking changes should mean a major version change. |
@misund once we hit 1.0 this will definitely be the case. Until then as the API becomes more hardened, breaking changes will be released as new minor versions. There is a note in the README regarding this https://github.com/mzabriskie/axios#semver. |
Thanks |
I've opened PR #416 in an attempt to add this note. |
This PR fixes #24 and #242.
Breaking change: Promise is now rejected with an
Error
rather than the response object.