@mrathod05/nestjs-exception-handler

2.0.2 • Public • Published

⚡ NestJS Exception Handler CLI

A simple CLI tool to help you handle exceptions globally in your NestJS application, promoting best practices and standardization.

📦 Installation

You can install the CLI globally or use it directly with npx.

npm install -g @mrathod05/nestjs-exception-handler

or

npx nestjs-exception-handler

🚀 Usage

Run the CLI in your project root:

npx nestjs-exception-handler

The CLI will help you integrate global exception handling by creating the necessary files for a standard setup.

Note: This tool does not install @nestjs/common or express automatically. It will remind you to install them yourself using your preferred package manager.

🛠️ What It Does

Guides you through setting up a global exception handler in your NestJS app

Promotes best practices for structured and consistent error handling

Configures response formats, stack traces, and logging for better debugging

Ensures you follow the proper NestJS structure for exception handling

🧪 Example

$ npx nestjs-exception-handler

⚙️  nestjs-exception-handler
Generate a customizable GlobalExceptionHandler for NestJS

✔ 👉 Enter target directory (e.g., src/common/filters) · test

✅ Global exception handler created at test/global-exception.filter.ts

📦 Required Dependencies:
Ensure the following packages are installed in your project:
- @nestjs/common → Core NestJS package for decorators and exception handling.
- express          → Web server framework used by NestJS under the hood.

📥 Install via:
npm: npm install @nestjs/common express
yarn: yarn add @nestjs/common express
pnpm: pnpm add @nestjs/common express

🧑‍💻 Developer

Meet Rathod

Package Sidebar

Install

npm i @mrathod05/nestjs-exception-handler

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

15.1 kB

Total Files

6

Last publish

Collaborators

  • mrathod05