I am trying to integrate Rollbar in Angular2 and following the example they have on their website.
But when I run
npm start
it gives me the following error
here is the code in app.module.ts
const rollbarConfig = { accessToken: 'ACCESS_TOKEN', captureUncaught: true, captureUnhandledRejections: true, }; export function getRollbarConfig() { return () => new Rollbar(rollbarConfig); } @Injectable() export class RollbarErrorHandler implements ErrorHandler { constructor(private injector: Injector) { } handleError(err:any) : void { var rollbar = this.injector.get(Rollbar); rollbar.error(err.originalError || err); } } . . . @NgModule({ providers: [ . . . { provide: Http, useClass: AuthenticatedHttpService }, BaseRequestOptions, CronBuilderService, { provide: ErrorHandler, useClass: RollbarErrorHandler }, { provide: Rollbar, useFactory: getRollbarConfig }, ], . . . })
If I remove this line
provide: Rollbar, useFactory: getRollbarConfig
it works and successfully compiled.
Thanks.