2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Improve error handling

This commit is contained in:
Nick Uraltsev
2016-06-13 13:56:08 -07:00
parent 120e8f5557
commit 91dae3c4ad
14 changed files with 120 additions and 41 deletions
+16
View File
@@ -0,0 +1,16 @@
'use strict';
var enhanceError = require('./enhanceError');
/**
* Create an Error with the specified message, config, and optional error code.
*
* @param {string} message The error message.
* @param {Object} config The config object.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @returns {Error} The created error.
*/
module.exports = function createError(message, config, code) {
var error = new Error(message);
return enhanceError(error, config, code);
};