Skip to content

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

Closed

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,
});

Activity

  1. rchl commented on Aug 29, 2019

    @rchl
    ContributorAuthor

    You can see below how it looks in the UI. Makes you assume that it's a failed assertion:
    Screenshot 2019-08-29 at 14 54 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions