NestJS SDK
Install @errtap/nestjs and report unhandled exceptions from your NestJS application via a global exception filter.
Install
npm i @errtap/nestjs@errtap/nestjs wraps @errtap/node and registers a global exception filter that reports
unhandled exceptions, then lets Nest's normal error handling continue.
Initialise
// app.module.ts
import { Module } from '@nestjs/common';
import { ErrTapModule } from '@errtap/nestjs';
@Module({
imports: [
ErrTapModule.forRoot({
dsn: process.env.ERRTAP_DSN!, // https://et_…@host
environment: process.env.NODE_ENV,
release: process.env.GIT_SHA,
}),
],
})
export class AppModule {}exitOnFatal defaults to false here (unlike plain @errtap/node) so Nest keeps owning
the process lifecycle.
Manual capture & logs
Everything from @errtap/node is re-exported:
import { captureException, captureMessage, logger } from '@errtap/nestjs';
logger.info('job started', { jobId });
try {
await work();
} catch (e) {
await captureException(e as Error, { context: { jobId } });
throw e;
}Options
| Field | Type | Description |
|---|---|---|
dsn | string | URL DSN (https://et_…@host) or bare key (requires endpoint) |
endpoint | string | Override ingest URL; optional when dsn is a URL DSN |
environment | string | e.g. production, staging |
release | string | Ties errors to a deploy |
tags | Record<string, unknown> | Attached to every event |
exitOnFatal | boolean | Exit after reporting an uncaughtException — default false under Nest |