UNPKG

@backtrace/nestjs

Version:
26 lines (25 loc) 1.18 kB
import { BacktraceClient } from '@backtrace/node'; import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common'; import { Observable } from 'rxjs'; import { BacktraceExceptionHandler, BacktraceExceptionHandlerOptions } from './backtrace.handler.js'; export type BacktraceInterceptorOptions = BacktraceExceptionHandlerOptions<ExecutionContext>; /** * Intercepts errors and sends them to Backtrace. */ export declare class BacktraceInterceptor implements NestInterceptor { private readonly _handler; /** * Creates an interceptor with the global client instance. * * The instance will be resolved while intercepting the request. * If the instance is not available, an error will be thrown. */ constructor(options?: BacktraceInterceptorOptions); /** * Creates an interceptor with the provided client instance. */ constructor(options: BacktraceInterceptorOptions | undefined, client: BacktraceClient); constructor(handler: BacktraceExceptionHandler<ExecutionContext>); intercept(context: ExecutionContext, next: CallHandler<unknown>): Observable<unknown>; private static extendBuildAttributes; }