Skip to content

Handling async and mouse event errors using context #64083

Answered by icyJoseph
HenryKenya asked this question in Help
Discussion options

You must be logged in to vote

Hi,

I'm well aware that ErrorBoundary in React does not handle errors from async and mouse events.

But you can make it be aware of them...

Kent C Dodds goes in depth about it here: https://kentcdodds.com/blog/use-react-error-boundary-to-handle-errors-in-react#handle-all-errors

And although he is using the react-error-boundary library, you could still do that yourself. Though I'd recommend using that library, because it develops the Error Boundary API very well.

Anyway, you can see how they implemented their solution here: https://github.com/bvaughn/react-error-boundary/blob/master/src/useErrorBoundary.ts

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@HenryKenya
Comment options

@HenryKenya
Comment options

Answer selected by HenryKenya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants