diff --git a/lib/find.js b/lib/find.js index 614dc64..80d9a54 100644 --- a/lib/find.js +++ b/lib/find.js @@ -57,7 +57,12 @@ function find (by, value, strict) { if (!(by in findBy)) { reject(new Error(`do not support find by "${by}"`)) } else { - findBy[by](value, strict).then(resolve, reject) + if (by === 'pid' && typeof value !== 'number') + reject(new Error(`pid must be a number`)) + else if (by === 'port' && typeof value !== 'number') + reject(new Error(`port must be a number`)) + else + findBy[by](value, strict).then(resolve, reject) } }) }