On this page
  1. Install
  2. Compose it in the application module
  3. Configuration reference
  4. Injection bridge
  5. Boundary
  6. Host-owned responses
  7. API entry points and requirements
  8. Peer dependencies

@playstack/nest-errors

NestJS dependency injection and exception filtering for an existing Playstack error reporter.

Free. MIT licensed. Check preview availability before installing. See package access.

@playstack/nest-errors attaches an existing @playstack/errors reporter to NestJS dependency injection and exception boundaries.

Install

sh
npm install @playstack/core @playstack/errors @playstack/nest-errors @nestjs/common @nestjs/core reflect-metadata rxjs

Compose it in the application module

ts
import { Module } from '@nestjs/common'
import {
  PlaystackErrorsFilter,
  PlaystackErrorsModule,
} from '@playstack/nest-errors'

@Module({
  imports: [
    PlaystackErrorsModule.forRoot({
      errors,
      captureHttpExceptions: false,
      resolveCaptureOptions(exception, host) {
        const request = host.switchToHttp().getRequest<AuthenticatedRequest>()
        return {
          accountId: request.account?.id,
          userId: request.user?.id,
          tags: { route: request.route?.path ?? 'unknown' },
        }
      },
    }),
  ],
})
export class AppModule {}

const app = await NestFactory.create(AppModule)
app.useGlobalFilters(app.get(PlaystackErrorsFilter))

The module exports the filter instead of installing an APP_FILTER implicitly. Apply it globally, to a controller, or to an individual route. Nest’s original HTTP response still passes through BaseExceptionFilter after capture.

Configuration reference

NestErrorsOptions propertyTypeRequiredPurpose
errorsErrorReporterYesExisting application reporter.
captureHttpExceptionsbooleanNoInclude expected HTTP responses below 500; defaults to false.
resolveCaptureOptions(exception, host) => options | false | undefinedNoAdd request-derived metadata, suppress capture with false, or use defaults with undefined.

Unknown exceptions and HTTP responses of 500 or greater are captured by default. Default metadata includes framework, transport type, status code, and an appropriate warning or error severity.

For configuration that depends on other Nest providers, use PlaystackErrorsModule.forRootAsync({ imports, inject, useFactory }).

Injection bridge

Inject PLAYSTACK_ERROR_REPORTER to receive the exact configured reporter in another provider:

ts
@Injectable()
class JobRunner {
  constructor(
    @Inject(PLAYSTACK_ERROR_REPORTER)
    private readonly errors: ErrorReporter,
  ) {}
}

NEST_ERRORS_OPTIONS, PLAYSTACK_ERROR_REPORTER, and PlaystackErrorsFilter are exported from the dynamic module.

Boundary

The adapter never reads request bodies, headers, cookies, or URLs automatically. The application decides which opaque identity and route metadata are safe to attach. It also owns reporting drivers, vendor SDK lifecycle, filter placement, and every Nest peer dependency.

Host-owned responses

A response-free capture helper and pure exception mapping allow the host to keep its HTTP envelope. Capture must not double-send or turn expected domain/tenancy errors into 500s. Rate-limit custom bodies retain library-owned status and headers. Use application integration tests for sanitized unknown errors, expected 4xx responses and reporter failure.

API entry points and requirements

Reference snapshot: @playstack/nest-errors@0.1.0-beta.1. Import only the entry point your runtime needs. Paths below are relative to the installed package; use Go to Definition in your editor to inspect exact parameters, return types and overloads. Do not import the declaration-file paths directly.

Public entry pointDeclaration file
@playstack/nest-errors./dist/index.d.ts
@playstack/nest-errors/errors./dist/errors.d.ts
@playstack/nest-errors/package.jsonNo TypeScript declaration (asset or metadata export).

Node.js engine requirement: >=20. This is not a claim that every entry point works in browsers or Workers.

Peer dependencies

Keep existing framework versions that satisfy these ranges. Install optional peers only when using the corresponding adapter. The package manager resolves ordinary dependencies separately.

PeerCompatible rangeWhen needed
@nestjs/common^10.0.0 || ^11.0.0Required by the package.
@nestjs/core^10.0.0 || ^11.0.0Required by the package.
@playstack/core0.1.0-beta.1Required by the package.
@playstack/errors0.1.0-beta.1Required by the package.
reflect-metadata^0.1.13 || ^0.2.0Required by the package.
rxjs^7.0.0Required by the package.

For a complete first program, start with Getting started. For API lookup and partial-example conventions, see Reading the reference. Provider failures, lifecycle requirements and application responsibilities remain described in the guide above; types alone do not establish production safety.

Go

Playstack Pro tag
OriginsPricingBlogNewsletterChangelogStatusRoadmap
ContributorsCommunityIn Use ShowcaseCase StudiesPartnersSponsors
FAQsSupportContact

© 2026 Playstack. All rights reserved.

With OSS
Terms of ServicePrivacy PolicyCookie PolicyImprint

By

Commune Software