---
title: "Discussion on \"Error Handling In NodeTS\" | Hashnode"
description: "Discussion on \"Error Handling In NodeTS\". Learn how to handle your exceptions in a smart way with Node + Typescript"
url: "https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Error Handling In NodeTS](https://thefeqy.hashnode.dev/error-handling-in-nodejs?utm_source=hashnode&utm_medium=feed)

Learn how to handle your exceptions in a smart way with Node + Typescript

Apr 16, 2022 · 6 min read · thefeqy.hashnode.dev  
Read the article

-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#express](https://hashnode.com/tag/express)
-   [#error-handling](https://hashnode.com/tag/error-handling)
-   [#mern](https://hashnode.com/tag/mern)
-   [#typescript](https://hashnode.com/tag/typescript)

## Written by

[Muhammed ElFeqy](https://hashnode.com/@thefeqy)

@thefeqy · Localhost

  
[View profile](https://hashnode.com/@thefeqy)

Software engineer sharing my thoughts

Hello world 👋, I'm a developer sharing my thoughts (📝) during my journey as a developer, consider subscribing so you can be notified once I shared anything.

## Responses 2

Markdown supported · ⌘↵ to post

[Salah Assi](https://hashnode.com/@salahassi)

[Apr 16, 2022](https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025/comment/625b31852f84e0d4fc33d8d7)

Well, congrats you got rid of try/catch but you got another issue which is you can't change either the error code or the error message. Basically, when you design a software to fullfil business needs, you need to be flexible, you should care about returning the right message and code more than using try/catch.

Thanks anyway 😅

[Muhammed ElFeqy](https://hashnode.com/@thefeqy)

[Apr 16, 2022](https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025/comment/625b31852f84e0d4fc33d8d7#reply-625b345152fb7bd53380f2a6)

Thank you, someone already commented about this but as i said it's out of the article scope, so i will either edit the article or write another one for this particular issue. If you need a solution you can checkout my node-ts kit you'll fine out what you seek. Here it is: [github.com/osclancer/node-ts](https://github.com/osclancer/node-ts) Thanks again ♥️

[Elias Soykat](https://hashnode.com/@elias-soykat)

[Apr 16, 2022](https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025/comment/625ad1ea2f84e0d4fc33d1f3)

Great article, but there is another problem raised. That is you can't overwrite the error message..

Like when user query with invalid email address than he get an uncaught exception that you can't overwrite if you using this method.

[Elias Soykat](https://hashnode.com/@elias-soykat)

[Apr 17, 2022](https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025/comment/625ad1ea2f84e0d4fc33d1f3#reply-625c41822f84e0d4fc33ec71)

[Muhammed ElFeqy](https://hashnode.com/@thefeqy)

hey bro, i am starting a node express project using your formula.

please give me your feedback for this pattern where i use another wrapper that call service (between route and controller i use service for my db connections)

i eageryl waiting for your feedback about this pattern, :)

[Muhammed ElFeqy](https://hashnode.com/@thefeqy)

[Apr 17, 2022](https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025/comment/625ad1ea2f84e0d4fc33d1f3#reply-625c6a4a52fb7bd5338109bc)

[Elias Soykat](https://hashnode.com/@elias-soykat) Sure, but I'm using Typescript. here you go: github.com/osclancer/node-ts

[Muhammed ElFeqy](https://hashnode.com/@thefeqy)

[Apr 17, 2022](https://hashnode.com/posts/error-handling-in-nodejs/625a389852fb7bd53380e025/comment/625ad1ea2f84e0d4fc33d1f3#reply-625c6a9252fb7bd5338109c2)

[Elias Soykat](https://hashnode.com/@elias-soykat) i also use services to be a data layer between my controllers & models
