npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nest-yalc-2/errors

v2.2.18

Published

<div align="center"> <h1>@nest-yalc-2/errors</h1> <p><em>Core enterprise module for the @nest-yalc-2/errors integration within the Ferrox/YALC ecosystem.</em></p>

Readme

npm version License

🚀 Installation

npm install @nest-yalc-2/errors
# or
yarn add @nest-yalc-2/errors
# or
pnpm add @nest-yalc-2/errors

⚠️ Exception Filters & Error Mapping (@nest-yalc-2/errors)

@nest-yalc-2/errors provides standardized NestJS 11+ Exception Filters mapping @node-yalc/errors to RFC 7807 Problem Details HTTP and GraphQL error responses.


🌟 Key Features

  • Global Exception Filter (YalcExceptionFilter): Intercepts @node-yalc/errors and standard NestJS exceptions globally.
  • RFC 7807 Problem Details Compliance: Formats HTTP error responses into standard application/problem+json structure.
  • Production Stack Trace Masking: Masks internal stack trace details in production while preserving correlation IDs.
  • GraphQL Error Extension Mapping: Formats Apollo and Mercurius GraphQL error extensions.

🔬 Internal Architecture & Execution Mechanics

flowchart TD
    Exception["AppError / DomainError Thrown"]
    GlobalFilter["YalcExceptionFilter Execution"]
    EnvCheck{"Environment Check (Production?)"}
    MaskedError["Sanitize Stack Trace & Internal DB Details"]
    FullError["Include Full Stack Trace (Development Only)"]
    RFCResponse["Emit RFC 7807 Problem Details JSON"]

    Exception --> GlobalFilter
    GlobalFilter --> EnvCheck
    EnvCheck -->|Production| MaskedError
    EnvCheck -->|Development| FullError
    MaskedError --> RFCResponse
    FullError --> RFCResponse

📊 Architectural Comparison: @nest-yalc-2/errors vs Standard NestJS Filters

| Feature / Dimension | ⚠️ @nest-yalc-2/errors | 🐢 Default NestJS Exception Filter | |---|---|---| | Response Format | RFC 7807 Problem Details Compliant | Basic { statusCode, message, error } | | Stack Trace Protection | Automated Production Masking | Exposes Stack Traces if unhandled | | Trace ID Injection | Automatically attaches X-Request-Id | Manual Formatting Required |


🚀 Practical Usage & Production Code Examples

1. Registering Global Exception Filter in AppModule

import { Module } from '@nestjs/common';
import { APP_FILTER } from '@nestjs/core';
import { YalcExceptionFilter } from '@nest-yalc-2/errors';

@Module({
  providers: [
    {
      provide: APP_FILTER,
      useClass: YalcExceptionFilter,
    },
  ],
})
export class AppModule {}

2. Throwing Typed Errors in Business Services

import { Injectable } from '@nestjs/common';
import { NotFoundError, ValidationError } from '@node-yalc/errors';

@Injectable()
export class AccountService {

  async findAccount(accountId: string) {
    if (!accountId) {
      throw new ValidationError('Account ID is required');
    }

    const account = null;
    if (!account) {
      throw new NotFoundError(`Account ${accountId} not found`, { accountId });
    }

    return account;
  }
}

⚠️ Common Pitfalls & Anti-Patterns

[!CAUTION] Catching Errors and Returning HTTP 200 OK: Returning 200 OK with { success: false, error: '...' } inside response bodies breaks REST semantics, caches error responses in CDNs, and confuses API clients. Always throw typed exceptions mapped by YalcExceptionFilter.


💡 Best Practices

[!TIP] Client Request Correlation: Include the returned instance trace ID when logging client-side errors to allow support engineers to locate the exact backend log line instantly.


🔗 Cross-References

To see how this module integrates with the rest of the Ferrox architecture, refer to the following documentation:


📚 Ecosystem Documentation

This module is a core component of the Ferrox enterprise microservice architecture.

👉 Read the Full Documentation on Ferrox-Rust.dev