summaryrefslogtreecommitdiff
path: root/lib/core/createError.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/core/createError.js')
-rw-r--r--lib/core/createError.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/core/createError.js b/lib/core/createError.js
new file mode 100644
index 0000000..933680f
--- /dev/null
+++ b/lib/core/createError.js
@@ -0,0 +1,18 @@
+'use strict';
+
+var enhanceError = require('./enhanceError');
+
+/**
+ * Create an Error with the specified message, config, error code, request and response.
+ *
+ * @param {string} message The error message.
+ * @param {Object} config The config.
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
+ * @param {Object} [request] The request.
+ * @param {Object} [response] The response.
+ * @returns {Error} The created error.
+ */
+module.exports = function createError(message, config, code, request, response) {
+ var error = new Error(message);
+ return enhanceError(error, config, code, request, response);
+};