mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
Modify createError and enhanceError functions to accept response as parameter
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
var enhanceError = require('./enhanceError');
|
||||
|
||||
/**
|
||||
* Create an Error with the specified message, config, and optional error code.
|
||||
* Create an Error with the specified message, config, error code, and response.
|
||||
*
|
||||
* @param {string} message The error message.
|
||||
* @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 created error.
|
||||
*/
|
||||
module.exports = function createError(message, config, code) {
|
||||
module.exports = function createError(message, config, code, response) {
|
||||
var error = new Error(message);
|
||||
return enhanceError(error, config, code);
|
||||
return enhanceError(error, config, code, response);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user