Skip to content
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

Merged
merged 2 commits into from
Jun 14, 2016
Merged

Improve error handling #345

merged 2 commits into from
Jun 14, 2016

Conversation

nickuraltsev
Copy link
Contributor

This PR fixes #24 and #242.

Breaking change: Promise is now rejected with an Error rather than the response object.

@@ -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;
Copy link
Member

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.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.0%) to 92.8% when pulling 6f2186d on nickuraltsev:errors2 into 120e8f5 on mzabriskie:master.

@mzabriskie mzabriskie merged commit f2c554e into axios:master Jun 14, 2016
@romainneutron
Copy link

This would have required a note in the UPGRADE_GUIDE.md file

@misund
Copy link

misund commented Jul 15, 2016

Breaking changes should mean a major version change.

@mzabriskie
Copy link
Member

@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.

@romainneutron
Copy link

Thanks

@levrik levrik mentioned this pull request Jul 18, 2016
@woodb
Copy link
Contributor

woodb commented Aug 16, 2016

Could you please note that this is a breaking change in the CHANGELOG?

I've opened PR #416 in an attempt to add this note.

@axios axios locked and limited conversation to collaborators May 3, 2020
simllll pushed a commit to hokify/axios that referenced this pull request Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reject with error
6 participants