DEV Community 👩‍💻👨‍💻

Discussion on: This is why your Node.js application is slow

Collapse
bias profile image
Tobias Nickel

I disagree of putting try catch around all await. most of the time when there is an error it should be logged, the current operation should stop and the frontend should get a error response. And this is done by frameworks nd the frameworks can often be oconfigured to do standard handling.

Only when actually doing real handling of an error like retry, or try
an alternative solution a try/catch should be used.

otherwise try catch blocks all over the place make code difficult to read (bloated) and often lead to inconsitencies how errors are logged, or discarded, responses are generated. Because we develop programs in teams not only on our own,...

Collapse
olasunkanmi profile image
Oyinlola Olasunkanmi • Edited on

when you use a try catch block within async and await, you can catch the exception and log it.

Collapse
necmettin profile image
Necmettin Begiter

How did you manage to disagree with something that said the exact same thing you said?