@bugwalk/angular
v0.2.3
Published
Angular adapter for Bugwalk: providers, ErrorHandler, and router instrumentation
Readme
@bugwalk/angular
Angular adapter for Bugwalk. Replaces Angular's ErrorHandler,
which is where every uncaught error goes — including errors inside change detection and
rejected observables, none of which reach window.onerror.
Supports Angular 16 and later.
Install
npm install @bugwalk/angularStandalone bootstrap
import { bootstrapApplication } from '@angular/platform-browser';
import { provideRouter } from '@angular/router';
import { provideBugwalk } from '@bugwalk/angular';
bootstrapApplication(AppComponent, {
providers: [
provideRouter(routes),
provideBugwalk({ dsn: environment.bugwalkDsn }),
],
});The SDK starts through APP_INITIALIZER, before the first component renders, so the initial
route resolution is covered.
NgModule
import { ErrorHandler, NgModule } from '@angular/core';
import { BugwalkErrorHandler, BUGWALK_OPTIONS } from '@bugwalk/angular';
import { init } from '@bugwalk/angular';
init({ dsn: environment.bugwalkDsn });
@NgModule({
providers: [{ provide: ErrorHandler, useClass: BugwalkErrorHandler }],
})
export class AppModule {}Named routes
import { Component, inject } from '@angular/core';
import { Router } from '@angular/router';
import { instrumentRouter } from '@bugwalk/angular';
@Component({ selector: 'app-root', template: '<router-outlet />' })
export class AppComponent {
constructor() {
instrumentRouter(inject(Router));
}
}This records the route configuration (/orders/:id) rather than the resolved URL, so an issue
affecting many people groups into one line instead of thousands.
Identify the person
import { identify } from '@bugwalk/angular';
identify({ id: user.id, email: user.email });Everything from @bugwalk/browser —
options, redaction, beforeSend, session handling — applies unchanged.
Apache-2.0
