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

Add global error boundary #303

Merged
merged 2 commits into from
Jun 18, 2020
Merged

Add global error boundary #303

merged 2 commits into from
Jun 18, 2020

Conversation

vadimdemedes
Copy link
Owner

Fixes #288.

This PR adds a global error boundary to catch errors that might occur during rendering of your app and display a pretty information about it:

image

I also discovered an issue when there would be "unhandled promise rejection" errors thrown when there's an error inside of a component. It was caused by waitUntilExit() function and specifically, exitPromise property in Ink instance. When Ink app is unmounted exitPromise is resolved or rejected, which causes waitUntilExit() to resolve. When there's an error and code didn't call waitUntilExit(), no one is basically listening to that promise, hence the "unhandled promise rejection" error. I fixed it by creating exitPromise only when waitUntilExit() is called.

@vadimdemedes vadimdemedes merged commit 2bcb4c0 into master Jun 18, 2020
@vadimdemedes vadimdemedes deleted the pretty-errors branch June 18, 2020 09:33
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.

Printing uncaught error messages
1 participant