Skip to content

Commit

Permalink
Merge branch 'feat/proto-client-telemetry' of github.com:launchdarkly…
Browse files Browse the repository at this point in the history
…/js-server-sdk-private into feat/proto-client-telemetry
  • Loading branch information
kinyoklion committed Sep 3, 2024
2 parents 0f65e42 + 326295f commit e807abf
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions packages/telemetry/browser-telemetry/src/BrowserTelemetryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,23 @@ export default class BrowserTelemetryImpl implements BrowserTelemetry {
}

captureError(exception: Error): void {
const data: ErrorData = {
type: exception.name || exception.constructor.name || 'generic',
message: exception.message,
stack: parse(exception, this.options.stack),
breadcrumbs: [...this.breadcrumbs],
sessionId: this.sessionId,
};
const validException = exception !== undefined && exception !== null;

const data: ErrorData = validException
? {
type: exception.name || exception.constructor?.name || 'generic',
message: exception.message,
stack: parse(exception, this.options.stack),
breadcrumbs: [...this.breadcrumbs],
sessionId: this.sessionId,
}
: {
type: 'generic',
message: 'null or undefined exception',
stack: { frames: [] },
breadcrumbs: [...this.breadcrumbs],
sessionId: this.sessionId,
};
this.capture(ERROR_KEY, data);
this.dispatchError(exception);
}
Expand Down

0 comments on commit e807abf

Please sign in to comment.