ErrTapDOCS

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

FieldTypeDescription
dsnstringURL DSN (https://et_…@host) or bare key (requires endpoint)
endpointstringOverride ingest URL; optional when dsn is a URL DSN
environmentstringe.g. production, staging
releasestringTies errors to a deploy
tagsRecord<string, unknown>Attached to every event
exitOnFatalbooleanExit after reporting an uncaughtException — default false under Nest