Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Unreleased

- [browser] feat: Use framesToPop for InvaliantViolations in React errors (#2204)
- [browser] fix: Make sure that falsy values are captured in unhandledrejections (#2207)
- [loader] fix: Loader should also retrigger falsy values as errors (#2207)

## 5.6.1

Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/integrations/globalhandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class GlobalHandlers implements Integration {
message.error && isString(message.error.message) ? message.error.message : 'No error message';
}

if (stacktrace.mechanism === 'onunhandledrejection' && stacktrace.incomplete) {
if (stacktrace.mechanism === 'onunhandledrejection' && (stacktrace.incomplete || stacktrace.mode === 'failed')) {
return this._eventFromIncompleteRejection(stacktrace, error);
}

Expand Down Expand Up @@ -166,8 +166,8 @@ export class GlobalHandlers implements Integration {
if (event.exception.values && event.exception.values[0]) {
event.exception.values[0].mechanism = {
data: {
incomplete: true,
mode: stacktrace.mode,
...(stacktrace.incomplete && { incomplete: stacktrace.incomplete }),
...(stacktrace.message && { message: stacktrace.message }),
...(stacktrace.name && { name: stacktrace.name }),
},
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
// content.p = promise rejection
// content.f = function call the Sentry
if (
(content.e ||
content.p ||
('e' in content ||
'p' in content ||
(content.f && content.f.indexOf('capture') > -1) ||
(content.f && content.f.indexOf('showReportDialog') > -1)) &&
lazy
Expand Down Expand Up @@ -139,9 +139,9 @@

// And now capture all previously caught exceptions
for (var i = 0; i < data.length; i++) {
if (data[i].e && tracekitErrorHandler) {
if ('e' in data[i] && tracekitErrorHandler) {
tracekitErrorHandler.apply(_window, data[i].e);
} else if (data[i].p && tracekitUnhandledRejectionHandler) {
} else if ('p' in data[i] && tracekitUnhandledRejectionHandler) {
tracekitUnhandledRejectionHandler.apply(_window, [data[i].p]);
}
}
Expand Down
11 changes: 8 additions & 3 deletions packages/browser/src/tracekit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,12 @@ TraceKit._report = (function reportModuleWrapper() {
* @see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
*/
function _traceKitWindowOnUnhandledRejection(e: any) {
var err = e && typeof e.reason !== 'undefined' ? e.reason : e;
var err = e;
// You cannot itterate over non-objects, but we want to check
// for the existence in any value, not for the value itself
try {
err = e && 'reason' in e ? e.reason : e;
} catch (_oO) {}
var stack = TraceKit._computeStackTrace(err);
stack.mechanism = 'onunhandledrejection';
_notifyHandlers(stack, true, err);
Expand Down Expand Up @@ -906,8 +911,8 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {

return {
original: ex,
name: ex.name,
message: ex.message,
name: ex && ex.name,
message: ex && ex.message,
mode: 'failed',
};
}
Expand Down
Loading