Skip to content

v1.7.0

Choose a tag to compare

@Fcmam5 Fcmam5 released this 11 May 21:52
· 26 commits to develop since this release
Immutable release. Only release title and notes can be modified.

What's Changed

This release adds the suppressDetail option to HttpExceptionFilter to prevent internal error messages from leaking to clients (done in #37), and improves runtime performance by eliminating repeated URL construction on the exception hot path (done in #38).

Features

  • suppressDetail option — pass true to omit detail on every response, or a callback for conditional suppression (e.g. only on 5xx errors). When using the module, override the SUPPRESS_DETAIL_KEY DI provider. A throwing callback is swallowed and treated as "do not suppress" so it can never crash the exception filter:
// Always suppress
new HttpExceptionFilter(app.get(HttpAdapterHost), '', undefined, true)

// Suppress selectively
new HttpExceptionFilter(app.get(HttpAdapterHost), '', undefined, ({ status }) => status >= 500)

// Via module
{ provide: SUPPRESS_DETAIL_KEY, useValue: ({ status }) => status >= 500 }
  • SuppressDetail type — exported from nest-problem-details-filter. Accepts boolean | ((ctx: SuppressDetailContext) => boolean).
  • SuppressDetailContext — exported context shape (status, type, exception) passed to the callback.
  • SUPPRESS_DETAIL_KEY — exported DI token for module-level configuration.

Performance

  • Precomputed type URI cache — HttpExceptionFilter now resolves all defaultHttpErrors entries against baseUri once at construction time and stores them in a Map<number, string>. The catch() hot path performs a single Map.get(status) instead of two new URL(...) allocations for the common case (native Nest exceptions and plain HttpException with no caller-supplied type). Exceptions with an explicit type (e.g. ProblemDetailsException) continue to resolve live and behave identically.

Full Changelog: v1.6.0...v1.7.0