What problem does it solve?
Inconsistent and unsafe error handling in backend services can expose internal details, cause crashes, and hinder debugging. This skill provides a unified approach for Node.js applications to manage operational and programming errors reliably.
Core Features & Use Cases
- Define a base
AppError class with status codes, error codes, and optional details.
- Implement a global Express error‑handling middleware that formats responses and logs operational errors.
- Create a NestJS global exception filter that mirrors the Express behavior for Nest applications.
- Capture unhandled promise rejections and uncaught exceptions, then perform a graceful shutdown of the server, database, cache, and background workers.
- Wrap external service calls in a helper that converts failures into consistent
AppError instances.
- Provide a checklist of common gotchas to avoid exposing stack traces or mixing error types.
Quick Start
Ask the assistant to generate a TypeScript error handling module for your Express or NestJS backend following the guidelines in this skill.