Skip to content

Put Error.cause in error data with ExtraErrorData integration #7051

Description

@lbogdan

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.36.0

SDK Setup

See below.

Steps to Reproduce

Given running the following script with node index.mjs:

// index.mjs
import Sentry from '@sentry/node';
import { ExtraErrorData } from '@sentry/integrations';

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  integrations: [
    new ExtraErrorData(),
  ],
});

function lower() {
  const err = new Error('lower');
  err.lowerFoo = 'baz';
  throw err;
}

function upper() {
  try {
    lower();
  } catch (lowerErr) {
    const err = new Error('upper', { cause: lowerErr });
    err.upperFoo = 'bar';
    console.error(err);
    throw err;
  }
}

upper();

Expected Result

As the errors are linked, I'd expect to see the extra data for both.

Actual Result

I can only see extra data for the upper error:

image

, although lowerFoo: 'baz' shows in the console.log() breadcrumb:

image

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions