How to get stackTrace info in FallbackComponent?
Closed this issue · 2 comments
Description of the question
I know we can do…
<ErrorBoundary
FallbackComponent={MyErrorPage}
onError={(error: Error, stackTrace: string) =>{ console.log(stackTrace) }}
>
…
</ErrorBoundary>
But does it possible to get stackTrace
info in MyErrorPage
(FallbackComponent) by using props
or something?
I don't want to do something about this outside MyErrorPage
(FallbackComponent) sorry.
Thanks.
Validations
- Follow our Code of Conduct
- Read the FAQ
- Check that there isn't already an issue asking the same question.
Hey! @l2aelba
Thanks for opening an issue, it's not possible to access the stackTrace
outside of the scope of the onError
function.
The FallbackComponent
only receives two props, error
and resetError
as you can see here:
react-native-error-boundary/src/ErrorBoundary/index.tsx
Lines 42 to 45 in 9683596
I don't want to do something about this outside MyErrorPage (FallbackComponent) sorry.
Not sure if I follow this, can you elaborate a bit more what you're trying to achieve?
Usually the stackTrace
shouldn't be exposed to your end users, it's something you should internally keep logged in your system. Therefore I don't think we should pass that to the FallbackComponent
, given that you can capture it in the onError
callback.
See:
Thanks for info.
I'm not sure also, I just thinking about stackTrace
has a useful information to send, just that.
And I just want to use it in FallbackComponent
easier.