Open navignaw opened 4 months ago
I think we have a general problem of errors not being propagated to the error boundary if thrown from a loop or the reconciler itself. We could use a correction here. #3181 is far simpler to fix, just more complex to test.
Do you have a suggestion for a catch-all solution that would work for both #3181 and this issue? I'd be happy to help test with my own project.
I'm wrapping a
@reat-three/fiber/native
Canvas element in an ErrorBoundary, but it's not properly handling errors.Here's a raw (minified) stack trace for an error in production:
the specific
react-three-fiber-native.cjs.prod.js
line maps to this renderFrame function:Unfortunately because this is in a callback that's called by the three.js code, any exceptions are uncaught and crash the native app.
One suggestion would be to wrap it in a try/except and call the setError function:
and this will get automatically thrown and therefore handled by a wrapping ErrorBoundary.
let me know if this sounds reasonable!
Possibly related: #3181