refactor: use TypeError instead of generic Error when appropriate (#39209)

refactor: use TypeError instead of generic Error when appropriate
This commit is contained in:
Milan Burda 2023-07-25 18:08:46 +02:00 committed by GitHub
parent 77cc1d6ffa
commit 455f57322f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 13 deletions

View file

@ -34,19 +34,19 @@ class ForkUtilityProcess extends EventEmitter {
if (options.execArgv != null) {
if (!Array.isArray(options.execArgv)) {
throw new Error('execArgv must be an array of strings.');
throw new TypeError('execArgv must be an array of strings.');
}
}
if (options.serviceName != null) {
if (typeof options.serviceName !== 'string') {
throw new Error('serviceName must be a string.');
throw new TypeError('serviceName must be a string.');
}
}
if (options.cwd != null) {
if (typeof options.cwd !== 'string') {
throw new Error('cwd path must be a string.');
throw new TypeError('cwd path must be a string.');
}
}