Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch exceptions in exec callback to ensure Promise is rejected #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chenhuang444
Copy link

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

@chenhuang444
Copy link
Author

Resolves this issue
#50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant