typeof name === 'string' &&
name.trim().length === 0
) {
- reject(new Error('name argument must not be an empty string'))
+ reject(new TypeError('name argument must not be an empty string'))
}
- if (name != null && !this.taskFunctions.includes(name)) {
+ if (
+ name != null &&
+ this.taskFunctions != null &&
+ !this.taskFunctions.includes(name)
+ ) {
reject(
new Error(`Task function '${name}' is not registered in the pool`)
)