Hey guys,
I am using Angular: "@angular/core": "7.2.4",
and sentry: "@sentry/browser": "4.6.3",
.
With the following code my application correctly throws an error:
// import * as Sentry from '@sentry/browser';
//
// Sentry.init({
// dsn: 'mydsn',
// debug: true
// });
@Injectable()
export class SentryErrorHandler implements ErrorHandler {
constructor() {}
handleError(error) {
throw error;
// Sentry.captureException(error.originalError || error);
// throw error;
}
}
@NgModule({
declarations: [
AppComponent
],
imports: [
// imports
],
providers: [
{provide: ErrorHandler, useClass: SentryErrorHandler},
],
bootstrap: [AppComponent]
})
However, as soon as I uncomment sentry, my app just hangs on error, eg:
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: 'mydsn',
debug: true
});
@Injectable()
export class SentryErrorHandler implements ErrorHandler {
constructor() {}
handleError(error) {
Sentry.captureException(error.originalError || error);
throw error;
}
}
@NgModule({
declarations: [
AppComponent
],
imports: [
// imports
],
providers: [
// {provide: ErrorHandler, useClass: SentryErrorHandler},
],
bootstrap: [AppComponent]
})
I have debug set to true and the console returns:
Sentry Logger [Log]: Integration installed: Dedupe
logger.js:30 Sentry Logger [Log]: Integration installed: InboundFilters
logger.js:30 Sentry Logger [Log]: Integration installed: FunctionToString
logger.js:30 Sentry Logger [Log]: Integration installed: ExtraErrorData
logger.js:30 Sentry Logger [Log]: Integration installed: TryCatch
logger.js:30 Sentry Logger [Log]: Integration installed: Breadcrumbs
logger.js:30 Sentry Logger [Log]: Integration installed: GlobalHandlers
logger.js:30 Sentry Logger [Log]: Integration installed: LinkedErrors
logger.js:30 Sentry Logger [Log]: Integration installed: UserAgent
In task manager on Google Chrome, CPU spikes and then ultimately the page crashes.
The error I am trying to test with is placing an arbitrary console.log(t);
Where t
is an undefined variable.
I am running this from localhost and can confirm I have allowed all traffic in the sentry project settings and can also confirm that the DSN is for the correct account.
Any help would be appreciated.
Thanks,
Ian