How to handle UnhandledException event ?

Hey Guys,

Can you tell me how to subscribe to UnhandledException Event, i’d like to handle it?


This event was not meant to be public. It’s mostly there for our internal use/tool consumption, and should have been marked @hide. As such, we strongly suggest you refrain from attempting to handle this event. May I ask why you’d like to handle it in the first place?

Thanks for your reply,

Fuse still have unstable libraries that could crash the App e.g (ImageTools base64 to Image method ) and not caught by .catch() method for even promises or non-promises methods, so we need something like this for app-wide error handling !
Aren’t we ?

Yes, our implementations are not perfect, but this event wouldn’t really help in most cases. If internal fuselibs code is throwing exceptions, it’s for good reason - invariants in the code have been violated, and continuing execution is most likely going to lead to yet more problems. Again, this event is for internal use only so that we can find and fix these bugs internally. Having users gaffer tape over the problem by handling this event is not a good fix in the long term.

So still i have to call those libraries from Uno code so that i can try then catch them right?

@Ahmed: no, that approach doesn’t sound right either. In short, what Jake said is that you shouldn’t try to “mask” any exceptions. They are meant to be thrown so that you & we actually see that there is a problem.

Otherwise, you’d end up with something that appears to be working fine, when in reality it isn’t.

The right approach is to fix the underlying causes of whatever crashes are happening. Either you can do it yourself (fuselibs are open source after all), or you can log a ticket for us to take a look.

@Uldis, you know that Fuse is our work Back-bone and our main methodology we have and we wouldn’t change it. We believe that Fuse will fix all issues of it’s internal libs. Until that, we should be able to tolerate any unexpected error to maintain the user experience. On of our apps have very bad results and the bounce rate is too high because the users faces a lot of crashes !.

So i’d like to have two things from Fuse :

1- App must be survivable.
2- Fuse mush have a better error reporting mechanism.

Hoping that sound good, and you gurus focusing on these two main points in the near future.


we should be able to tolerate any unexpected error to maintain the user experience

No, that is just a wrong assumption. Pretending that everything is fine when all hell breaks loose behind the scenes is not how you maintain user experience.

If your app is crashing for users, best you can do is figure out why. We’d love to see actual stack traces, aggregated information about the affected devices, OS versions etc. Anything that can help us narrow down the cause and fix it.

If you see how Fuse could benefit from a better error reporting mechanism, you are very welcome to post a feature suggestion and outline what/how it should work. I’ll make sure to pass that info on to the right people internally.