summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/fetch-error.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/fetch-error.js')
-rw-r--r--deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/fetch-error.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/fetch-error.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/fetch-error.js
new file mode 100644
index 0000000000..338e1e2729
--- /dev/null
+++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/fetch-error.js
@@ -0,0 +1,35 @@
+'use strict'
+
+/**
+ * fetch-error.js
+ *
+ * FetchError interface for operational errors
+ */
+
+/**
+ * Create FetchError instance
+ *
+ * @param String message Error message for human
+ * @param String type Error type for machine
+ * @param String systemError For Node.js system error
+ * @return FetchError
+ */
+module.exports = FetchError
+function FetchError (message, type, systemError) {
+ Error.call(this, message)
+
+ this.message = message
+ this.type = type
+
+ // when err.type is `system`, err.code contains system error code
+ if (systemError) {
+ this.code = this.errno = systemError.code
+ }
+
+ // hide custom error implementation details from end-users
+ Error.captureStackTrace(this, this.constructor)
+}
+
+FetchError.prototype = Object.create(Error.prototype)
+FetchError.prototype.constructor = FetchError
+FetchError.prototype.name = 'FetchError'