BugSnag - Use Comment To Ignore A Specific Exception?

58 Views Asked by At

I have an exception class that looks like

import { NotFoundException } from '@nestjs/common';

export class MyExceptionClass extends NotFoundException {
  constructor(id: string) {
    super(`Did not find something`);
  }
}

This is a soft exception in the sense that a search request made to our API endpoint didn't find a match. Is it possible for me to retain this exception, but have BugSnag ignore it in the code?

Something like:

export class MyExceptionClass extends NotFoundException {
  constructor(id: string) {
    /* bugsnag-ignore */
    super(`Did not find something`);
  }
}

I still need the caught exception to be thrown since it bubbles up and allows the calling endpoint to return a correct response. But I'd like to exclude these exceptions from being logged into BugSnag.

I know I can ignore this whole exception group in BugSnag itself, but I'd prefer a solution where I can explicitly mark in the codebase that these exceptions are not being sent to BugSnag.

0

There are 0 best solutions below