Skip to content

Commit f4c0e33

Browse files
committed
Use toError for jquery and angular errors
1 parent b362466 commit f4c0e33

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/angularjs/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { BrowserExceptionlessClient, Exceptionless } from "@exceptionless/browser";
1+
import { toError } from "@exceptionless/core";
2+
import {
3+
BrowserExceptionlessClient,
4+
Exceptionless
5+
} from "@exceptionless/browser";
26

37
declare let angular;
48
angular.module("exceptionless", [])
@@ -65,7 +69,8 @@ angular.module("exceptionless", [])
6569
});
6670

6771
$rootScope.$on("$routeChangeError", (_event, current, previous, rejection) => {
68-
void $ExceptionlessClient.createUnhandledException(new Error(rejection as string), "$routeChangeError")
72+
const error: Error = toError(rejection, "Route Change Error");
73+
void $ExceptionlessClient.createUnhandledException(error, "$routeChangeError")
6974
.setProperty("current", current)
7075
.setProperty("previous", previous)
7176
.submit();

packages/browser/src/plugins/BrowserGlobalHandlerPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class BrowserGlobalHandlerPlugin implements IEventPlugin {
4646
void this._client?.submitNotFound(settings.url);
4747
} else if (xhr.status !== 401) {
4848
// TODO: Handle async
49-
void this._client?.createUnhandledException(new Error(error), "JQuery.ajaxError")
49+
void this._client?.createUnhandledException(toError(error) as Error, "JQuery.ajaxError")
5050
.setSource(settings.url)
5151
.setProperty("status", xhr.status)
5252
.setProperty("request", settings.data)

0 commit comments

Comments
 (0)