Skip to content

Commit df8e5b8

Browse files
authored
Merge branch 'master' into feat/tracing
2 parents 90d8a6a + bc4cb71 commit df8e5b8

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
---
2-
name: 🐛 Bug Report
2+
name: "\U0001F41B Bug Report"
33
about: Report a reproducible bug or regression in Sentry JavaScript SDKs.
4+
title: ''
5+
labels: 'Status: Needs Triage'
6+
assignees: ''
7+
48
---
59

610
<!-- Requirements: please go through this checklist before opening a new issue -->
711

812
- [ ] Review the documentation: https://docs.sentry.io/
913
- [ ] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
1014
- [ ] Use the latest release: https://github.com/getsentry/sentry-javascript/releases
15+
- [ ] Provide a link to the affected event from your Sentry account
1116

1217
## Package + Version
1318

@@ -25,4 +30,4 @@ about: Report a reproducible bug or regression in Sentry JavaScript SDKs.
2530

2631
## Description
2732

28-
Describe your issue in detail, ideally you have a reproducible demo that you can show.
33+
Describe your issue in detail, ideally, you have a reproducible demo that you can show.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- [hub] feat: Add new function to Scope `setContext`
99
- [hub] feat: Add new function to Scope `setTransaction`
1010

11+
## 5.1.3
12+
13+
- [browser] fix: GlobalHandler integration sometimes receives Event objects as message: Fix #1949
14+
1115
## 5.1.2
1216

1317
- [browser] fix: Fixed a bug if Sentry was initialized multiple times: Fix #2043

packages/browser/src/integrations/globalhandlers.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getCurrentHub } from '@sentry/core';
22
import { Event, Integration } from '@sentry/types';
3-
import { addExceptionTypeValue, logger, normalize, truncate } from '@sentry/utils';
3+
import { addExceptionTypeValue, isString, logger, normalize, truncate } from '@sentry/utils';
44

55
import { eventFromStacktrace } from '../parsers';
66
import {
@@ -91,6 +91,14 @@ export class GlobalHandlers implements Integration {
9191
* @param stacktrace TraceKitStackTrace to be converted to an Event.
9292
*/
9393
private _eventFromGlobalHandler(stacktrace: TraceKitStackTrace): Event {
94+
if (!isString(stacktrace.message) && stacktrace.mechanism !== 'onunhandledrejection') {
95+
// There are cases where stacktrace.message is an Event object
96+
// https://github.com/getsentry/sentry-javascript/issues/1949
97+
// In this specific case we try to extract stacktrace.message.error.message
98+
const message = (stacktrace.message as unknown) as any;
99+
stacktrace.message =
100+
message.error && isString(message.error.message) ? message.error.message : 'No error message';
101+
}
94102
const event = eventFromStacktrace(stacktrace);
95103

96104
const data: { [key: string]: string } = {

packages/integrations/src/ember.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Ember implements Integration {
4242
if (getCurrentHub().getIntegration(Ember)) {
4343
getCurrentHub().withScope(scope => {
4444
this._addIntegrationToSdkInfo(scope);
45-
getCurrentHub().captureException(error);
45+
getCurrentHub().captureException(error, { originalException: error });
4646
});
4747
}
4848

@@ -61,7 +61,7 @@ export class Ember implements Integration {
6161
if (reason instanceof Error) {
6262
scope.setExtra('context', 'Unhandled Promise error detected');
6363
this._addIntegrationToSdkInfo(scope);
64-
getCurrentHub().captureException(reason);
64+
getCurrentHub().captureException(reason, { originalException: reason });
6565
} else {
6666
scope.setExtra('reason', reason);
6767
this._addIntegrationToSdkInfo(scope);

0 commit comments

Comments
 (0)