summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/child_process.js4
-rw-r--r--lib/crypto.js2
-rw-r--r--lib/dns.js5
-rw-r--r--lib/events.js2
-rw-r--r--lib/fs.js6
-rw-r--r--lib/punycode.js2
6 files changed, 11 insertions, 10 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index 5fcd26039..a38de2867 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -860,9 +860,9 @@ function _validateStdio(stdio, sync) {
// Cleanup previously created pipes
cleanup();
if (!sync)
- throw Error('Child process can have only one IPC pipe');
+ throw new Error('Child process can have only one IPC pipe');
else
- throw Error('You cannot use IPC with synchronous forks');
+ throw new Error('You cannot use IPC with synchronous forks');
}
ipc = createPipe(true);
diff --git a/lib/crypto.js b/lib/crypto.js
index 6033a85e5..10ff71e85 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -548,7 +548,7 @@ ECDH.prototype.getPublicKey = function getPublicKey(encoding, format) {
else if (format === 'uncompressed')
f = constants.POINT_CONVERSION_UNCOMPRESSED;
else
- throw TypeError('Bad format: ' + format);
+ throw new TypeError('Bad format: ' + format);
} else {
f = constants.POINT_CONVERSION_UNCOMPRESSED;
}
diff --git a/lib/dns.js b/lib/dns.js
index 4572d253f..d39eec878 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -108,12 +108,13 @@ exports.lookup = function lookup(hostname, options, callback) {
// Parse arguments
if (hostname && typeof hostname !== 'string') {
- throw TypeError('invalid arguments: hostname must be a string or falsey');
+ throw new TypeError('invalid arguments: ' +
+ 'hostname must be a string or falsey');
} else if (typeof options === 'function') {
callback = options;
family = 0;
} else if (typeof callback !== 'function') {
- throw TypeError('invalid arguments: callback must be passed');
+ throw new TypeError('invalid arguments: callback must be passed');
} else if (options !== null && typeof options === 'object') {
hints = options.hints >>> 0;
family = options.family >>> 0;
diff --git a/lib/events.js b/lib/events.js
index 6bd2a77db..064f3838b 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -140,7 +140,7 @@ EventEmitter.prototype.emit = function emit(type) {
} else if (er instanceof Error) {
throw er; // Unhandled 'error' event
} else {
- throw Error('Uncaught, unspecified "error" event.');
+ throw new Error('Uncaught, unspecified "error" event.');
}
return false;
}
diff --git a/lib/fs.js b/lib/fs.js
index adcb70802..77bcbac61 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -1628,12 +1628,12 @@ function ReadStream(path, options) {
if (this.start !== undefined) {
if (typeof this.start !== 'number') {
- throw TypeError('start must be a Number');
+ throw new TypeError('start must be a Number');
}
if (this.end === undefined) {
this.end = Infinity;
} else if (typeof this.end !== 'number') {
- throw TypeError('end must be a Number');
+ throw new TypeError('end must be a Number');
}
if (this.start > this.end) {
@@ -1790,7 +1790,7 @@ function WriteStream(path, options) {
if (this.start !== undefined) {
if (typeof this.start !== 'number') {
- throw TypeError('start must be a Number');
+ throw new TypeError('start must be a Number');
}
if (this.start < 0) {
throw new Error('start must be >= zero');
diff --git a/lib/punycode.js b/lib/punycode.js
index 82cc20769..51aa75132 100644
--- a/lib/punycode.js
+++ b/lib/punycode.js
@@ -64,7 +64,7 @@
* @returns {Error} Throws a `RangeError` with the applicable error message.
*/
function error(type) {
- throw RangeError(errors[type]);
+ throw new RangeError(errors[type]);
}
/**