How to handle Node.js errors like a Pro?

How to handle Node.js errors like a Pro?

Software Developer Diaries

10 месяцев назад

23,169 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@dilibanm7861
@dilibanm7861 - 02.01.2024 10:56

This channel is a hidden gem, far better than many channels. Loved all the videos. Must subscribe people. 🫡

Ответить
@Vriskh4oj
@Vriskh4oj - 25.12.2023 00:09

Omg I am a self educated begginer developer, and 3 days ago, I did the same thing. I just felt the need to throw custom error. Im glad I fid the right thing

Ответить
@peter_kip
@peter_kip - 22.12.2023 17:31

Thanks for this.

Ответить
@hamzaaslam8843
@hamzaaslam8843 - 27.11.2023 13:20

such a great video one thing i missed here is . I saw a comment of someone on stack overflow, guy created asyncWrapper as customer middleware around all api routes
const asyncWrapper = (cb) => {
return (req, res, next) => cb(req, res, next).catch(next);
};
I want to know your opinion on this approach.
Basically i am learning nodejs and i wanted to make sure that if i missed any error handling in my api there should be some place from where i can simply return 500 instead of terminating the process or let it get timeout that will of course cause issue on server end.

Ответить
@scottamolinari
@scottamolinari - 18.09.2023 10:04

It's pronounced walla"bee".

Ответить
@rajanacharya6360
@rajanacharya6360 - 09.09.2023 11:50

Great video. Subscribed!, I have been also following same approach. Would like to request you to consider making videos for topic like best practice, code quality, optimization, debugging, performant code etc.

Ответить
@dawid_dahl
@dawid_dahl - 13.08.2023 09:16

Great video. Subscribed!

Ответить
@LarutanAK
@LarutanAK - 13.08.2023 02:41

Not long ago I had to revamp the error handling system of over 20 projects with over 5 different approachs mixed within them.
Working on an enterprise level for a multibillion dollar company that has this kind of anti-pattern and literally no code review can be a nightmare, but it is extremely educational.

Took me not much more than a couple of weeks of work time, but I am glad to see that the final result is pretty much what you taught on this video.

Most junior and mid-level developers dont pay a lot of attention to error handling. This video is absolute gold in terms of best practices.

Ответить
@acousticmunda6400
@acousticmunda6400 - 12.08.2023 21:02

OMG it is so helpful, I am feeling like a Pro now😅

Ответить
@nulI_dev
@nulI_dev - 12.08.2023 20:27

I have been using a very similar `RequestError` class to throw errors inside my express controllers and components.

I then have a single app.use() middleware that catches and handles errors from `instanceof RequestError` and `instanceof ZodError`.

It makes the code a lot easier to read as it reduces a lot of control flow

Ответить
@sadik.h
@sadik.h - 12.08.2023 18:48

awesome in depth video, explained very nicely. Next time in my app Ill try to do the things you just demonstrated, need more video like this. You might also consider making videos for topic like best practice, code quality, optimization, debugging, performant code etc. Just a bit of content ideas from me thats all. overall keep up the good work!

Ответить