@@ -4,7 +4,7 @@ declare var exceptionless;
4
4
5
5
angular . module ( 'exceptionless' , [ ] )
6
6
. constant ( '$ExceptionlessClient' , exceptionless . ExceptionlessClient . default )
7
- . factory ( 'exceptionlessHttpInterceptor' , [ '$q' , '$ExceptionlessClient' , function ( $q , $ExceptionlessClient ) {
7
+ . factory ( 'exceptionlessHttpInterceptor' , [ '$q' , '$ExceptionlessClient' , ( $q , $ExceptionlessClient ) => {
8
8
return {
9
9
responseError : function responseError ( rejection ) {
10
10
if ( rejection . status === 404 ) {
@@ -21,28 +21,29 @@ angular.module('exceptionless', [])
21
21
}
22
22
} ;
23
23
} ] )
24
- . config ( [ '$httpProvider' , '$provide' , '$ExceptionlessClient' , function ( $httpProvider , $provide , $ExceptionlessClient ) {
24
+ . config ( [ '$httpProvider' , '$provide' , '$ExceptionlessClient' , ( $httpProvider , $provide , $ExceptionlessClient ) => {
25
25
$httpProvider . interceptors . push ( 'exceptionlessHttpInterceptor' ) ;
26
- $provide . decorator ( '$exceptionHandler' , [ '$delegate' , function ( $delegate ) {
27
- return function ( exception , cause ) {
26
+ $provide . decorator ( '$exceptionHandler' , [ '$delegate' , ( $delegate ) => {
27
+ return ( exception , cause ) => {
28
28
$delegate ( exception , cause ) ;
29
29
$ExceptionlessClient . createUnhandledException ( exception , '$exceptionHandler' ) . setMessage ( cause ) . submit ( ) ;
30
30
} ;
31
31
} ] ) ;
32
- $provide . decorator ( '$log' , [ '$delegate' , function ( $delegate ) {
32
+ $provide . decorator ( '$log' , [ '$delegate' , ( $delegate ) => {
33
33
function decorateRegularCall ( property , logLevel ) {
34
34
const previousFn = $delegate [ property ] ;
35
- return $delegate [ property ] = function ( ) {
35
+ return $delegate [ property ] = ( ... args ) => {
36
36
if ( angular . mock ) {
37
37
// Needed to support angular-mocks.
38
38
$delegate [ property ] . logs = [ ] ;
39
39
}
40
- previousFn . apply ( null , arguments ) ;
41
- if ( arguments [ 0 ] && arguments [ 0 ] . length > 0 ) {
42
- $ExceptionlessClient . submitLog ( null , arguments [ 0 ] , logLevel ) ;
40
+ previousFn . apply ( null , args ) ;
41
+ if ( args [ 0 ] && args [ 0 ] . length > 0 ) {
42
+ $ExceptionlessClient . submitLog ( null , args [ 0 ] , logLevel ) ;
43
43
}
44
44
} ;
45
45
}
46
+
46
47
$delegate . log = decorateRegularCall ( 'log' , 'Trace' ) ;
47
48
$delegate . info = decorateRegularCall ( 'info' , 'Info' ) ;
48
49
$delegate . warn = decorateRegularCall ( 'warn' , 'Warn' ) ;
@@ -51,8 +52,8 @@ angular.module('exceptionless', [])
51
52
return $delegate ;
52
53
} ] ) ;
53
54
} ] )
54
- . run ( [ '$rootScope' , '$ExceptionlessClient' , function ( $rootScope , $ExceptionlessClient ) {
55
- $rootScope . $on ( '$routeChangeSuccess' , function ( event , next , current ) {
55
+ . run ( [ '$rootScope' , '$ExceptionlessClient' , ( $rootScope , $ExceptionlessClient ) => {
56
+ $rootScope . $on ( '$routeChangeSuccess' , ( event , next , current ) => {
56
57
if ( ! current ) {
57
58
return ;
58
59
}
@@ -63,14 +64,14 @@ angular.module('exceptionless', [])
63
64
. submit ( ) ;
64
65
} ) ;
65
66
66
- $rootScope . $on ( '$routeChangeError' , function ( event , current , previous , rejection ) {
67
+ $rootScope . $on ( '$routeChangeError' , ( event , current , previous , rejection ) => {
67
68
$ExceptionlessClient . createUnhandledException ( new Error ( rejection ) , '$routeChangeError' )
68
69
. setProperty ( 'current' , current )
69
70
. setProperty ( 'previous' , previous )
70
71
. submit ( ) ;
71
72
} ) ;
72
73
73
- $rootScope . $on ( '$stateChangeSuccess' , function ( event , toState , toParams , fromState , fromParams ) {
74
+ $rootScope . $on ( '$stateChangeSuccess' , ( event , toState , toParams , fromState , fromParams ) => {
74
75
if ( ! toState || toState . name === 'otherwise' ) {
75
76
return ;
76
77
}
@@ -83,7 +84,7 @@ angular.module('exceptionless', [])
83
84
. submit ( ) ;
84
85
} ) ;
85
86
86
- $rootScope . $on ( '$stateNotFound' , function ( event , unfoundState , fromState , fromParams ) {
87
+ $rootScope . $on ( '$stateNotFound' , ( event , unfoundState , fromState , fromParams ) => {
87
88
if ( ! unfoundState ) {
88
89
return ;
89
90
}
@@ -95,8 +96,8 @@ angular.module('exceptionless', [])
95
96
. submit ( ) ;
96
97
} ) ;
97
98
98
- let stateChangeError = '$stateChangeError' ;
99
- $rootScope . $on ( stateChangeError , function ( event , toState , toParams , fromState , fromParams , error ) {
99
+ const stateChangeError = '$stateChangeError' ;
100
+ $rootScope . $on ( stateChangeError , ( event , toState , toParams , fromState , fromParams , error ) => {
100
101
if ( ! error ) {
101
102
return ;
102
103
}
@@ -111,7 +112,7 @@ angular.module('exceptionless', [])
111
112
. submit ( ) ;
112
113
} ) ;
113
114
114
- $rootScope . $on ( '$destroy' , function ( ) {
115
+ $rootScope . $on ( '$destroy' , ( ) => {
115
116
$ExceptionlessClient . config . queue . process ( ) ;
116
117
} ) ;
117
118
} ] ) ;
0 commit comments