2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Modify createError and enhanceError functions to accept response as parameter

This commit is contained in:
Nick Uraltsev
2016-06-13 18:58:55 -07:00
parent 91dae3c4ad
commit 6f2186d863
3 changed files with 16 additions and 10 deletions
+5 -3
View File
@@ -1,17 +1,19 @@
'use strict';
/**
* Update an Error with the specified config and optional error code.
* Update an Error with the specified config, error code, and response.
*
* @param {Error} error The error to update.
* @param {Object} config The config object.
* @param {Object} config The config.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
@ @param {Object} [response] The response.
* @returns {Error} The error.
*/
module.exports = function enhanceError(error, config, code) {
module.exports = function enhanceError(error, config, code, response) {
error.config = config;
if (code) {
error.code = code;
}
error.response = response;
return error;
};