Repository navigation
Is there a way to catch an error on top store level? #2286
|
Is there a way to catch an error on top store level? ModelB has an action \ flow which fail with error. So, I want to track back this error on rootStore level. Kinda 'Unknow error'. ModelB is able to handle some of errors, but all others - throw it up! I've tried to use middleware (or rootStore level): And I get the error. But I get it twice or more. I suppose it depends on action's store sub-level. Please, help me comprehend what I'm doing wrong. |
Answered by
coolsoftwaretyler
Mar 26, 2026
Replies: 1 comment 7 replies
|
Hey @Lao-Ax - I'll try to take a look at this soon. In the meantime, any chance you could post a CodeSandbox of what you're trying to do? It would help me answer you more thoroughly. |
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @Lao-Ax - you might want to try createActionTrackingMiddleware2 for this instead. It gives you a cleaner start/finish api surface for actions, and you can write something like this:
Which will check if there's an error in the call, and you can then check if the call had a parent, and only lift the error up once.