An interface that is used when tracking application errors.
| Property | Desciption |
|---|---|
error: Error |
The error object being thrown. |
id: string |
optional A useful identifier for the event. |
scopes?: [] |
optional A list of scopes to include with the event. |
In this example an AppErrorEvent is being tracked via a custom error handler. The event is then fed to the trackAppError method on the EventDispatchService. The objects in scopes are completely customizable and determined by consuming applications.
import { AppErrorEvent, EventDispatchService } from 'oculr-ngx';
@Injectable()
export class AppErrorHandler implements ErrorHandler {
constructor(private eventDispatchService: EventDispatchService) {}
handleError(error: AppError | HttpErrorResponse): void {
const event: AppErrorEvent = {
error,
id: error instanceof AppError ? error.name : error.status?.toString(),
scopes: [
{
// the following property is only an example
level: 'application',
},
],
};
this.eventDispatchService.trackAppError(event);
}
}Is something not working or unclear? Please create an issue or PR.