diff --git a/example/browser/index.html b/example/browser/index.html index 6116a752..83c80388 100644 --- a/example/browser/index.html +++ b/example/browser/index.html @@ -23,6 +23,7 @@

Log Submission

+

Diagnostics

diff --git a/example/browser/index.js b/example/browser/index.js index 59168aa9..b772df3b 100644 --- a/example/browser/index.js +++ b/example/browser/index.js @@ -45,6 +45,14 @@ document.addEventListener("DOMContentLoaded", () => { }); } + document + .querySelector("#submit-error-log-with-error") + .addEventListener("click", async () => { + const builder = Exceptionless.createLog("Button Click", "Error Log with Error"); + builder.context.setException(new Error("test")); + await builder.submit(); + }); + document .querySelector("#throw-custom-error") .addEventListener("click", () => { diff --git a/packages/browser/src/plugins/BrowserErrorPlugin.ts b/packages/browser/src/plugins/BrowserErrorPlugin.ts index 3ac49edc..6912a201 100644 --- a/packages/browser/src/plugins/BrowserErrorPlugin.ts +++ b/packages/browser/src/plugins/BrowserErrorPlugin.ts @@ -22,7 +22,9 @@ export class BrowserErrorPlugin implements IEventPlugin { public async run(context: EventPluginContext): Promise { const exception = context.eventContext.getException(); if (exception) { - context.event.type = "error"; + if (!context.event.type) { + context.event.type = "error"; + } if (context.event.data && !context.event.data[KnownEventDataKeys.Error]) { const result = await this.parse(exception); diff --git a/packages/core/src/plugins/default/SimpleErrorPlugin.ts b/packages/core/src/plugins/default/SimpleErrorPlugin.ts index 80ff837b..fb62e674 100644 --- a/packages/core/src/plugins/default/SimpleErrorPlugin.ts +++ b/packages/core/src/plugins/default/SimpleErrorPlugin.ts @@ -31,7 +31,9 @@ export class SimpleErrorPlugin implements IEventPlugin { public async run(context: EventPluginContext): Promise { const exception = context.eventContext.getException(); if (exception) { - context.event.type = "error"; + if (!context.event.type) { + context.event.type = "error"; + } if (context.event.data && !context.event.data[KnownEventDataKeys.SimpleError]) { const error = { diff --git a/packages/node/src/plugins/NodeErrorPlugin.ts b/packages/node/src/plugins/NodeErrorPlugin.ts index 16bca6d1..ccc29550 100644 --- a/packages/node/src/plugins/NodeErrorPlugin.ts +++ b/packages/node/src/plugins/NodeErrorPlugin.ts @@ -18,7 +18,9 @@ export class NodeErrorPlugin implements IEventPlugin { public async run(context: EventPluginContext): Promise { const exception = context.eventContext.getException(); if (exception) { - context.event.type = "error"; + if (!context.event.type) { + context.event.type = "error"; + } if (context.event.data && !context.event.data[KnownEventDataKeys.Error]) { const result = await this.parse(exception);