Mobx: report errors from catch block instead of finally

Created on 23 Dec 2016  路  6Comments  路  Source: mobxjs/mobx

Hi
I sometimes get Mobx warnings about an uncaught exception from a finally block at peekUntracked() in computedValue.ts.
catching the original exception is sometimes tricky and time consuming (like when you run cluncky test tools that has a lot of caught exceptions themselves). It would be much easier if the spy / console.warn would be triggered from within a context that has the uncaught exception - the catch clause, as the line calls console.warn is one click away, so it's simple to add a breakpoint there.
another option is adding the offending exception to the spy report, in addition to throwing it.

Most helpful comment

@amir-arad mutable sounds cool!

All 6 comments

@amir-arad, totally unrelated, tell me what cool stuff is happening here :) https://github.com/wix/mutable

Mutable is a data class library with type validations, read-only views etc.
I've recently replaced its internal dirty checking mechanism with mobx, now i'm translating it to typescript and generally making it faster and prettier.

I've just noticed, the readme is very outdated 馃槉

Maybe the nice solution to this problem is to not do anything with exceptions in general. I think MobX since the latest versions recovers in all cases nicely from errors. So I think the warning is might be no longer needed at all, and that it should just be documented that errors are not propagated to observers.

Closed in favor of follow up #731

@amir-arad mutable sounds cool!

Was this page helpful?
0 / 5 - 0 ratings