Skip to content

Commit

Permalink
Merge pull request #9 from fed135/feat/enrich-cancel-error
Browse files Browse the repository at this point in the history
feat: enrich error when request is cancelled with params
  • Loading branch information
fed135 committed Aug 12, 2019
2 parents 16bc327 + c90e95d commit ea3ca76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/adapters/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ module.exports = function httpAdapter(config) {
if (req.aborted) return;

req.abort();
reject(cancel);
reject(enhanceError(cancel, config, null, req));
});
}

Expand Down
3 changes: 2 additions & 1 deletion lib/adapters/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var buildURL = require('./../helpers/buildURL');
var parseHeaders = require('./../helpers/parseHeaders');
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
var createError = require('../core/createError');
var enhanceError = require('../core/enhanceError');

module.exports = function xhrAdapter(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
Expand Down Expand Up @@ -158,7 +159,7 @@ module.exports = function xhrAdapter(config) {
}

request.abort();
reject(cancel);
reject(enhanceError(cancel, config, null, request));
// Clean up request
request = null;
});
Expand Down

0 comments on commit ea3ca76

Please sign in to comment.