Hi Alexander,
You could use an error callback in the subscription:
o.subscribe(
v => console.log('this never happens'),
err => console.log('this happens ;-)', err)
);
Regards,
Arnaud.
On Sunday, 27 December 2020 at 05:26:22 UTC+1 [email protected] wrote:
> In front-end JS, is there a way to catch errors globally?
>
> For example, we might have:
>
> const o = new Observable(o => {
> o.error('unhandled error')
> });
>
> o.subscribe(v => console.log('this never happens')
>
>
> so we have a 1 sub, and so the observable becomes active, but there is
> nobody to catch the error, is there a way to capture the error globally?
>
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/2f083465-369f-4ddf-b31d-c1dabad327f9n%40googlegroups.com.