Search code examples
sendgridsentry

Sentry mixing errors


I'm trying to loop through a response object and send individual errors to Sentry. I'm working with the Sendgrid API response array of errors.

I have tried the below code, but it doesn't seem to work with Sentry.

try {
    await SendgridCall()
} catch (errors) {
  errors.response.body.errors.forEach(error => {
     let err = new Error(error.message)
     err.name = 'SendgridError'
     Sentry.captureException(err);
  })
}

I expect Sentry to create different error events based on the error message, but that doesn't seem to be happening. Instead it is merging most of the errors, and creating error events with mixed message (top message is different from message inside the event in the console).


Solution

  • The events are getting grouped in a single issue.

    Please note you can still see the individual events:

    Cycle through issues in sentry.io

    By default Sentry will show you the newest one.

    If you'd like to change how they get grouped, you could use fingerprint for that. Be aware that by default Sentry will notify you (i.e email) for each new issue.