Skip to content

Commit da180da

Browse files
committed
Throw explicit error message about bad input
1 parent bf23c07 commit da180da

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

index.js

+8
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,14 @@ FSWatcher.prototype.add = function(paths, _origAdd, _internal) {
474474
this.closed = false;
475475
paths = flatten(arrify(paths));
476476

477+
function isString(maybeString) {
478+
return typeof maybeString === 'string'
479+
}
480+
481+
if (!paths.every(isString)) {
482+
throw new TypeError('Non-string provided as watch path');
483+
}
484+
477485
if (cwd) paths = paths.map(function(path) {
478486
if (isAbsolute(path)) {
479487
return path;

0 commit comments

Comments
 (0)