Sentry.io custom error titles

Sentry.io custom error titles

·

1 min read

Should be easy and straightforward, yet I had to find a (not so elegant) workaround.

Sentry.init({
...
  beforeSend: function(event, hint) {
   ...
    event.exception.values[0].type = 'My-Custom-Title';
    return event;
  }
});

Basically someone said somewhere that Sentry takes the exception type as a title, and it seems to work :D

If you want to access other information from the event context to include in the title (which was my case), you can access it directly there:

Sentry.init({
...
  beforeSend: function(event, hint) {
    const context = event.contexts['context-name'];
    event.exception.values[0].type = context['field-name'];
    return event;
  }
});

Some say the message property of the event gives the title, but I tried it, and it was only shown as a regular property in the list, under tags.