@@ -67,6 +67,15 @@ function $LogProvider() {
67
67
} ;
68
68
69
69
this . $get = [ '$window' , function ( $window ) {
70
+ // Support: IE 9-11, Edge 12-14+
71
+ // IE/Edge display errors in such a way that it requires the user to click in 4 places
72
+ // to see the stack trace. There is no way to feature-detect it so there's a chance
73
+ // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't
74
+ // break apps. Other browsers display errors in a sensible way and some of them map stack
75
+ // traces along source maps if available so it makes sense to let browsers display it
76
+ // as they want.
77
+ var formatStackTrace = msie || / \b E d g e \/ / . test ( $window . navigator && $window . navigator . userAgent ) ;
78
+
70
79
return {
71
80
/**
72
81
* @ngdoc method
@@ -124,14 +133,7 @@ function $LogProvider() {
124
133
125
134
function formatError ( arg ) {
126
135
if ( arg instanceof Error ) {
127
- // Support: IE 9-11, Edge 12-14+
128
- // IE/Edge display errors in such a way that it requires the user to click in 4 places
129
- // to see the stack trace. There is no way to feature-detect it so there's a chance
130
- // of the user agent sniffing to go wrong but since it's only about logging, this shouldn't
131
- // break apps. Other browsers display errors in a sensible way and some of them map stack
132
- // traces along source maps if available so it makes sense to let browsers display it
133
- // as they want.
134
- if ( arg . stack && ( msie || / \b E d g e \/ / . test ( $window . navigator . userAgent ) ) ) {
136
+ if ( arg . stack && formatStackTrace ) {
135
137
arg = ( arg . message && arg . stack . indexOf ( arg . message ) === - 1 )
136
138
? 'Error: ' + arg . message + '\n' + arg . stack
137
139
: arg . stack ;
0 commit comments