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)
Just used this in one of my recent project. The colored logs is game changer. Great work due.
Glad you liked it.