Exceptions thrown in mapSelect
function of useSelect
hook should be reported in Sentry
#3979
Labels
[Type] Enhancement
Improves a current area of the editor
Describe the bug
In a recently spotted Sentry issue, we've seen the following exception thrown in this line of the inserter menu:
Unfortunately, this exception doesn't give any clue about what happened as it's not expected that a call to the
useSelect
hook returns anundefined
object. Investigating further, we noticed that exceptions thrown within themapSelect
function passed in the hook caused the same error but didn't include the stacktrace of the exception itself.The reason for this is that the
useSelect
hook executes themapSelect
function in atry-catch
block (reference), so exceptions are not reported upstream, only its side-effect in the shape of anundefined
object and an error log in the RN console (reference).This issue is making harder the task of debugging errors/crashes and it might be covering other potential issues, so it would be great to figure out a way to report them to Sentry.
To Reproduce
throw Error( 'error test' );
into this line.undefined is not an object
is shown.An error occurred while running 'mapSelect': error test
is logged.Expected behavior
Exceptions thrown in the
mapSelect
function ofuseSelect
hooks should be reported to Sentry.Screenshots
N/A
Smartphone (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: