When an error occurs in a re-frame sub, it often crashes the app; e.g. a common one is we call (sort-by (comp str/lower-case :name) ,,,) in a sub when sometimes it occurs that :name is nil.
often the stack trace will bottom out somewhere in clojure.core or re-frame, and not point at the particular subscription function which actually caused the crash.
anyone figured out a way to capture these errors in a way that links it back to the particular subscription that failed?
hmm, could be an issue with how we're using using reagent with hooks then- we have a use-reaction hook that we use with helix that uses a combo of useSubscription + run-in-reaction to replicate the behavior of derefing inside a reagent component. I'll look further into that.
I see the component that ended up derefing that sub - that's pretty much always enough. Although I agree that seeing the sub itself would be more useful.
Ah, hold on - I see the component in a stacktrace made by React. The original stacktrace does show the exact location.
Clicking on the link navigates me to the exact line where I put a throw. And I haven't made any special setup to make it work.
Just tried with a sub that gets used only as a signal - same result, everything's perfectly clear.