_Question_
Hi there,
I am looking for a way to handle the YellowBox.js:67 Possible Unhandled Promise Rejection (id: 0):
Error: [mobx-state-tree] Error while converting, every time I got an ...is not assignable to type...
I tried to read the docs, search for previous questions, to use middlewares, but I didn't find an easy way to throw the error to my errors handler (like bugsnag or Sentry).
Thanks !
I'm afraid you'll need to provide more info
Let say we made a change on our back end, the data is[{test: 0}]. Previously it was, [{test: false}]
If my store is waiting for a boolean : test: types.optional(types.boolean,false), I will get the error [mobx-state-tree] Error while converting, because a number is not assignable to a boolean
Every time mobx-state-tree is throwing an error error [mobx-state-tree] Error while converting, my app will not display the content because of that error, and I will not get the error, I am getting it in DEV, in the console (or yellowbox of RN), but I would like to be able to handle the Promise
Does that make more sense ?
https://github.com/mobxjs/mobx-state-tree/blob/master/docs/API/README.md#typecheck
With that function you can run a typecheck of a type against a json (snapshot) and catch the exception it will throw
I see, I will try with the typecheck thanks :)
Could be cool to have .catch(), on a Store, for handling every errors which happens in the store
Feel free to open an issue with any proposal about catch or to reopen this one if you need more help :)
For now closing this one
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.
Most helpful comment
I see, I will try with the typecheck thanks :)
Could be cool to have .catch(), on a Store, for handling every errors which happens in the store