node-machine-id
node-machine-id copied to clipboard
Catch exceptions in exec callback to ensure Promise is rejected
What
Adds try-catch block to exec callback for machineId()
Why
A Promise has an implicit try-catch reject logic. However, the callback from exec is not handled by this implicit try-catch. Thus any exceptions thrown in expose() will not be caught and the promise will not be rejected.
I noticed this when some of my users had a
TypeError: Cannot read property 'replace' of undefined
error on sentry
Risk
Low: simple try catch block, does not change original resolve, reject behavior
Resolves this issue #50