error-handler

Standardize NestJS microservice error handling with BaseRpcException and gRPC status mapping.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/lety-ai/lety-skill-hub --skill error-handler-lety-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handler
Source: https://github.com/lety-ai/lety-skill-hub/tree/main/plugins/error-handler/skills/error-handler
Command: npx skills add https://github.com/lety-ai/lety-skill-hub --skill error-handler-lety-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent or incorrect error handling in NestJS microservices and the API gateway leads to wrong gRPC status codes, improper HTTP mappings, swallowed exceptions, and blocked RabbitMQ queues. This Skill helps engineers convert ad-hoc exceptions into standardized BaseRpcException usage, apply TypeORM exception filters, and implement explicit ack/nack semantics so errors are observable and routed correctly.

Core Features & Use Cases

  • gRPC status mapping: Decide and enforce correct gRPC status codes for not found, invalid arguments, permission errors, duplicates, transient failures, and internal errors.
  • BaseRpcException patterns: Provide canonical throw patterns for services so microservices never use HttpException subclasses and always supply specific status codes.
  • TypeORM exception filters: Add and apply filters for EntityNotFoundError and QueryFailedError to translate DB errors into appropriate gRPC statuses.
  • RabbitMQ ack/nack handling: Ensure every RMQ handler acknowledges or rejects messages with clear rules for requeue vs dead-letter behavior.
  • Anti-pattern detection and fixes: Review code to flag HttpException in microservices, silent catch blocks, missing nacks, and global misuse of INTERNAL status, then show corrected implementations.

Quick Start

Paste the NestJS service, controller, or RabbitMQ handler code you want reviewed and request a focused error handling audit that returns identified issues and corrected implementations.

Frequently Asked Questions about error-handler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle gRPC errors in NestJS microservices without using HTTP exceptions?

To handle gRPC errors in NestJS microservices, convert ad-hoc exceptions into standardized BaseRpcException patterns with specific gRPC status codes instead of HttpException subclasses to ensure correct routing and observability.

Why does my RabbitMQ queue get blocked when a message handler throws an error in NestJS?

RabbitMQ queues get blocked when handlers swallow exceptions or miss acknowledgements. Enforce explicit channel.ack and channel.nack patterns with clear requeue decisions to prevent blocked queues and manage dead-letter behavior.

How do I map TypeORM QueryFailedError and EntityNotFoundError to gRPC status codes?

Map TypeORM database errors to gRPC status codes by applying TypeORM exception filters that translate EntityNotFoundError and QueryFailedError into appropriate BaseRpcException instances with specific status codes.

What is the best way to route gRPC responses through a NestJS API gateway to HTTP?

The best way to route gRPC responses to HTTP is by implementing an RpcToHttpInterceptor that maps gRPC status codes to correct HTTP responses, ensuring the API gateway translates microservice exceptions properly.

How do I stop silent catch blocks and global INTERNAL status misuse in NestJS?

Stop silent catch blocks and INTERNAL status misuse by auditing code to detect anti-patterns, flag missing nacks, and replace generic errors with canonical BaseRpcException throws using specific gRPC status codes.

Can I use this error handling approach for my auth and platform microservices?

Yes, you can apply this error handling approach across api, platform, and auth services to standardize BaseRpcException usage, enforce RabbitMQ ack/nack semantics, and map gRPC status codes consistently.