Back to Explore

fastify/fastify-error

GitHub
1 watchersOpen source

Last release:

@fastify/error is a small utility used by Fastify to generate consistent error objects across your codebase and plugins. It exports a function to create custom error constructors with a standardized code, message (optionally with string interpolation), and optional status code, base error type, and stack trace capture.

Project status

  • Actively maintained (evidence: there was an upstream push on 2026-08-07, and the project has continued to ship new functionality in the v3.x to v4.x series).
  • Apparent update cadence: the most recent documented update is v4.2.0 on 2025-06-01, with the prior update v4.1.0 on 2025-03-12 (about 2.5 to 3 months apart), followed by a long gap until the next known documented update, though there has been activity as of 2026-08-07.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v4.2.0

    v4.2.0 introduces a new instanceof implementation for errors created by @fastify/error, intended to make instanceof checks behave correctly. It also includes CI workflow permission tweaks and a dev dependency bump for tsd.

    Features
  • v4.1.0

    v4.1.0 primarily introduces a new optional `captureStackTrace` parameter to the exported `createError` factory, allowing callers to control whether stack traces are captured. The release also updates development and CI tooling (test runner, coverage, linting, and workflow version) plus some minor housekeeping changes.

    Features
  • v4.0.0

    Release v4.0.0 primarily updates development tooling and housekeeping. The code diff shows changes limited to CI workflow configuration, .gitignore, and devDependency version bumps, with no runtime source-code changes.

  • v3.4.1

    v3.4.1 makes a small internal test and packaging cleanup, plus a bug fix around how the error factory detects a { cause } object among its arguments. The only functional code change is in index.js, where the condition for extracting and assigning err.cause was corrected.

  • v3.4.0

    v3.4.0 adds support for attaching an error `cause` to generated Fastify error instances, along with a small performance-oriented tweak to builtin imports. The release notes also mention a tsd/dev tooling bump and cleanup/docs improvements.

    Features
  • v3.3.0

    v3.3.0 updates @fastify/error with changes focused on error construction performance and how the optional Base argument is handled when creating error classes. The release notes mention a Base type fix (and a revert of a prior attempt) plus a performance improvement to error creation.

  • v3.2.1

    v3.2.1 refactors the core FastifyError creation logic and improves performance around stack trace handling when Error.stackTraceLimit is 0. It also expands TypeScript typings to better model the argument types passed to the generated error constructors, and adds benchmarks plus some CI/dev tooling updates.

    Features
  • v3.2.0

    v3.2.0 primarily updates the TypeScript typings for @fastify/error, making createError return more strictly typed error constructors. It also bumps the devDependency tsd from 0.24.1 to 0.25.0 and updates the tsd type tests accordingly.

  • v3.1.0

    v3.1.0 mainly updates development and CI tooling, switching the test runner to tap and enabling additional checks like license checking. The release also updates type-related tooling (tsd) and makes changes intended to improve NodeNext compatibility.

  • v3.0.0

    v3.0.0 updates repository documentation references, migrates the CI workflow to a Fastify reusable workflow, and bumps the development test runner (ava) from 3.9.0 to 4.0.1. The provided diff shows no library/runtime source code changes, only CI, docs, and dev dependency changes.