DEV Community

Cover image for express-error-toolkit — the One NPM Package to Handle All Express Errors

express-error-toolkit — the One NPM Package to Handle All Express Errors

Error handling in Express has always been repetitive:

writing the same notFoundHandler, globalErrorHandler, asyncHandler, and custom error classes across every project.

Even with libraries like express-async-errors, you still end up wiring things manually — and none of them improve the DX in the terminal.

That’s why I built — 🔗 express-error-toolkit


✨ Core Features

  • ✅ Pre-built middleware: globalErrorHandler, notFoundHandler
  • ✅ Type-safe custom error classes (e.g. NotFoundError, BadRequestError)
  • ✅ Simple asyncHandler utility to avoid try-catch blocks
  • httpError() helper for one-liner errors
  • ✅ Colorful, readable console logs (no chalk needed)
  • ✅ Works with both CommonJS & ESM
  • ✅ Fully configurable (via .env or code)
  • ✅ Built with DX in mind

📖 Detailed guide, usage examples & console previews here:

➡️ Read the full article


If you find it useful, please consider giving it a ⭐ on GitHub 💙

🔗 GitHub Repo

Top comments (2)

Collapse
 
dr-63 profile image
dr • Edited

Just used this in one of my recent project. The colored logs is game changer. Great work due.

Collapse
 
dev-rashedin profile image
Rashedin | FullStack Developer

Glad you liked it.