refactor: use TypeError
instead of generic Error
when appropriate (#39209)
refactor: use TypeError instead of generic Error when appropriate
This commit is contained in:
parent
77cc1d6ffa
commit
455f57322f
9 changed files with 13 additions and 13 deletions
|
@ -16,7 +16,7 @@ export class IpcMainImpl extends EventEmitter {
|
|||
throw new Error(`Attempted to register a second handler for '${method}'`);
|
||||
}
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error(`Expected handler to be a function, but found type '${typeof fn}'`);
|
||||
throw new TypeError(`Expected handler to be a function, but found type '${typeof fn}'`);
|
||||
}
|
||||
this._invokeHandlers.set(method, fn);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue