Skip to content

Commit fbe11f5

Browse files
committed
Merge pull request #47 from exceptionless/feature/better-angular-errors
Improved stacking for angular errors.
2 parents 83eae7a + 176075d commit fbe11f5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dist/integrations/angular.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ angular.module('exceptionless', [])
77
$ExceptionlessClient.submitNotFound(rejection.config.url);
88
}
99
else if (rejection.status !== 401) {
10-
$ExceptionlessClient.createUnhandledException(new Error("[" + rejection.status + "] " + rejection.config.url), 'errorHttpInterceptor')
10+
var message = "[" + rejection.status + "] " + (rejection.data && rejection.data.Message ? rejection.data.Message : rejection.config.url);
11+
$ExceptionlessClient.createUnhandledException(new Error(message), 'errorHttpInterceptor')
12+
.setManualStackingInfo({ Status: rejection.status, ExceptionType: 'Error', Path: rejection.config.method + ' ' + rejection.config.url })
1113
.setSource(rejection.config.url)
1214
.setProperty('request', rejection.config)
1315
.submit();

src/integrations/angular.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ angular.module('exceptionless', [])
1010
if (rejection.status === 404) {
1111
$ExceptionlessClient.submitNotFound(rejection.config.url);
1212
} else if (rejection.status !== 401) {
13-
$ExceptionlessClient.createUnhandledException(new Error(`[${rejection.status}] ${rejection.config.url}`), 'errorHttpInterceptor')
13+
let message = `[${rejection.status}] ${(rejection.data && rejection.data.Message ? rejection.data.Message : rejection.config.url)}`;
14+
$ExceptionlessClient.createUnhandledException(new Error(message), 'errorHttpInterceptor')
15+
.setManualStackingInfo({ Status: rejection.status, ExceptionType: 'Error', Path: rejection.config.method + ' ' + rejection.config.url })
1416
.setSource(rejection.config.url)
1517
.setProperty('request', rejection.config)
1618
.submit();

0 commit comments

Comments
 (0)