Skip to content

console.assert adds a breadcrumb even when assertion doesn't fail #2211

Closed
@rchl

Description

@rchl

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.6.2

Description

With Sentry enabled, trigger console.assert(true, 'this never fails') and then capture exception. You'll see breadcrumb for non-failing assert added in the event. It's confusing and wrong to have breadcrumb added if assertion didn't fail. Browser doesn't print anything for non-failing assertion.

Relevant code:

if (level === 'assert') {
if (args[0] === false) {
breadcrumbData.message = `Assertion failed: ${safeJoin(args.slice(1), ' ') || 'console.assert'}`;
breadcrumbData.data.extra.arguments = normalize(args.slice(1), 3);
}
}
Breadcrumbs.addBreadcrumb(breadcrumbData, {
input: args,
level,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions