Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global exception handling

Tags:

angular

Is it possible to globally catch exceptions thrown in an Angular 2 application to prevent the entire app from breaking from errors in any one component?

like image 972
Lance Hardwood Avatar asked Jun 30 '16 18:06

Lance Hardwood


People also ask

What is global exception handling?

The Global Exception Handler is a type of workflow designed to determine the project's behavior when encountering an execution error. Only one Global Exception Handler can be set per automation project.

What is global exception handling in spring?

Global Exception Handler - Exception Handling is a cross-cutting concern, it should be done for all the pointcuts in our application. We have already looked into Spring AOP and that's why Spring provides @ControllerAdvice annotation that we can use with any class to define our global exception handler.

What is global exception handling in C#?

An ExceptionFilterAttribute is used to collect unhandled exceptions. You can register it as a global filter, and it will function as a global exception handler. Another option is to use a custom middleware designed to do nothing but catch unhandled exceptions.


1 Answers

As google explain, you can override error handler service to do what you want. https://angular.io/docs/ts/latest/api/core/index/ErrorHandler-class.html

like image 74
Saulfa Avatar answered Oct 03 '22 22:10

Saulfa