Description
I have a project where I followed the Sentry angular documentation at:
https://docs.sentry.io/platforms/javascript/angular/
And it worked fine and we were getting errors.
Seemed to work find for 7+ months. Soon as we started getting more users, we noticed that the number of errors in Sentry had increased a lot - a few 10s of thousands more than what we expected.
On debugging, I tried just disabling Sentry and was surprised to see quite a lot of errors still being reported!
I am using Angular 7 with "@sentry/browser": "^5.5.0",
The error is from a network call that is giving me a unauthorized because some users try to access something they are not supposed to.
We catch these and show them a "Unauthorized" page appropriately. So, I don't want Sentry to report these!
The way we set it up is:
import * as Sentry from '@sentry/browser';
import { ErrorHandler, Injectable } from '@angular/core';
@Injectable()
export class SentryErrorHandler implements ErrorHandler {
constructor() {
Sentry.init({dsn: '.....'});
}
handleError(error: Error) {
if (error instanceof Error) {
console.error(error);
// Sentry.captureException(error); // <--- Even after commenting this out, Errors are reported.
}
}
}
I'm trying to figure out what is reporting these errors.
I see the stacktrace to be from Angular's zone modules. but I haven't configured it to report anything there to the best of my knowledge.