-4

I’m building a Node.js backend (using Express + TypeScript) and I want to implement a clean, scalable, SOLID-friendly error handling system.

My goal is:

Developer Side: Print a detailed error log in the console (stack trace, metadata, etc.).

Client Side: Return a safe, formatted error response without exposing sensitive details.

I also use Prisma ORM, and when I checked their documentation, there are a huge number of Prisma-specific error codes. It’s not possible to manually handle every single one, especially since Prisma isn’t the only tool in my stack.

So my questions are:

  • How can I send different errors to developers and users cleanly?

I want an error-handling approach that is scalable, maintainable, and clean, rather than manually checking hundreds of error types.

New contributor
Gourabananda Datta is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.