Skip to content

Commit

Permalink
fix: don't reply with an error if the child is not available anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl committed Apr 9, 2024
1 parent 910e843 commit 981b255
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/parent-process/threadedClass.ts
Expand Up @@ -144,9 +144,13 @@ export function threadedClass<T, TCtor extends new (...args: any) => T> (
)
})
.catch((err: Error) => {
// Don't reply if there's nooone to receive the answer
if (!instance.child.alive || instance.child.isClosing) return
replyError(instance, msg, err)
})
} catch (err) {
// Don't reply if there's nooone to receive the answer
if (!instance.child.alive || instance.child.isClosing) return
replyError(instance, msg, err)
}
} else throw Error(`callback "${msg.callbackId}" not found in instance ${m.instanceId}`)
Expand Down

0 comments on commit 981b255

Please sign in to comment.