Catch error (uncaught)


#1

Hello,

I would like to ask you a question about UncaughtError.
Is there a way to put a big try catch somewhere (over the rainbow!!) to catch all the unexpected crash in order to send my report.

My backend is in java. When I reach my endpoint I do a crappy but safe try catch throwable in order to send me an email with the details if it is for example a NPE or something like this.

Is it possible to do it in Ionic project. I would like to have an handler which will call the report processor (firebase or something else)

Thanks for your answer

Cheers


#2

You could try something like this:


#3

It depends what you mean by “error.” Error handling of Observables is different from that of Promises. Also, do you really want the backend to have to deal with everything? Sometimes it’s correct to quietly retry, while other times it’s correct to stop and post an alert.


#4

The posting of alert is already done and the catching on observable as well.
However I am talking about unexpected issues like:

  • cannot read property blablabla of undefined etc.

I am in test phase so I would like to track everything :slight_smile: