Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Apr 7, 2022

@timfish timfish mentioned this pull request Apr 7, 2022
15 tasks
@AbhiPrasad AbhiPrasad merged commit 81b10fb into getsentry:7.x Apr 7, 2022
@AbhiPrasad AbhiPrasad added this to the 7.0.0 milestone Apr 7, 2022
lobsterkatie pushed a commit that referenced this pull request Apr 7, 2022
These exports were historically used in `@sentry/electron`, but are no longer being used by the Electron SDK or the React Native SDK, so they can be removed.
Lms24 pushed a commit that referenced this pull request Apr 26, 2022
These exports were historically used in `@sentry/electron`, but are no longer being used by the Electron SDK or the React Native SDK, so they can be removed.
lobsterkatie pushed a commit that referenced this pull request Apr 26, 2022
These exports were historically used in `@sentry/electron`, but are no longer being used by the Electron SDK or the React Native SDK, so they can be removed.
@timfish timfish deleted the v7/remove-eventbuilder-exports branch May 19, 2022 13:14
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
These exports were historically used in `@sentry/electron`, but are no longer being used by the Electron SDK or the React Native SDK, so they can be removed.
@maclockard
Copy link

This is a breaking change that wasn't called out in the release notes, if I'm using these functions, what should I used instead
?

maclockard added a commit to maclockard/sentry-javascript that referenced this pull request Sep 15, 2022
@timfish
Copy link
Collaborator Author

timfish commented Sep 15, 2022

Sorry this didn't end up highlighted as a breaking change in the release notes.

What are you using these exports for?

@maclockard
Copy link

I was using them to pass an event to captureEvent. Is there a preferred alternative for constructing an event to pass to that method?

@AbhiPrasad
Copy link
Member

Hey @maclockard - thanks for reaching out. Here we expect folks you to just directly use captureException or captureMessage instead of doing captureEvent(eventFromException(new Error('example')).

Why are you preferring to use captureEvent here? captureEvent is meant for use cases where you directly set attributes using the event payload docs and our TypeScript types.

@maclockard
Copy link

maclockard commented Sep 16, 2022

Why make folks who are manually setting some of the event fields manually set all of them? What I was doing was using the event builder methods to make an event then overriding some fields manually before capturing.

@AbhiPrasad
Copy link
Member

We recommend folks use beforeSend, or our event processor API to accomplish mutating events. For example:

const myError = new Error(...);

Sentry.withScope((scope) => {
  scope.addEventProcessor(event => {
    if (badCondition) {
      // don't send event to Sentry
      return null;
    }

    event.X = ...
    event.Y = ...
    return event;
  });
  Sentry.captureException(myError);
});

We intentionally constrain the top level API surface so that we can more easily make improvements and changes without user impact.

Both eventFromException and eventFromMessage were undocumented APIs - they do not show up on https://docs.sentry.io

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants