Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global Exception handler in angularjs

Tags:

angularjs

In angularjs is it possible to add global exception handler at one place? So even if you miss to add exception handler for any code user will get a proper message. E.g Something went wrong.

like image 595
Anand Gargate Avatar asked Dec 04 '15 11:12

Anand Gargate


1 Answers

angular.module("app")
.factory("$exceptionHandler",  function() {
        return function (exception, cause) {
            //exception handling here
        };
    });

From here

like image 110
R. Salisbury Avatar answered Oct 02 '22 23:10

R. Salisbury