How to handle Node.js errors like a Pro?

  Рет қаралды 22,434

Software Developer Diaries

Software Developer Diaries

10 ай бұрын

In this video, we're gonna learn the various best practices of Error Handling in Node.js, such as central error handling, graceful process exists and extending the JavaScript's Error object.
======⚡⚡⚡======
Licenses are valid only until the 31st of August 2013, first come first serve! ❤️
👉 Quokka License 1: wallabyjs.com/store/personal/...
👉 Quokka License 2: wallabyjs.com/store/personal/...
👉 Quokka License 3: wallabyjs.com/store/personal/...
👉 Wallaby License 1: wallabyjs.com/store/personal/...
👉 Wallaby License 2: wallabyjs.com/store/personal/...
======⚡⚡⚡======
🙌 Become my Patreon and get exclusive perks: / softdevdiaries
💼 Follow me on LinkedIn and drop me a message if you'd like: / gusgadirov
💻 Also, let's connect on GitHub: github.com/gusgad
📚 Resources:
Original tutorial source: github.com/goldbergyoni/nodeb...
Code: github.com/gusgad/youtube-tut...
And don't forget to subscribe for more videos like this 😊

Пікірлер: 29
@LarutanAK
@LarutanAK 10 ай бұрын
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.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 9 ай бұрын
Thanks for sharing your story, that's very insightful. Would you say the points mentioned in the video are sufficient when it comes to the code. Or were there any other patterns you used when refactoring? :)
@LarutanAK
@LarutanAK 9 ай бұрын
@@SoftwareDeveloperDiaries I really liked your approach, showing the do's and dont's (many of which I've seen during the process lol) I developed a library to centralize all error handling through a middleware, using a similar approach with an error dictionary and custom error types (easy to reuse on all projects). The biggest issue was how the errors were thrown: Promise.rejects, .catch(), just arbritrary throws and/or try-catches, or simply nothing at all... for that I went with hexagonal pattern, piping all errors towards the error-handler and its dictionary through a few adapters (simple and cleaner code) For the final result, any custom error can be simply added to the dictionary, along with a function that will handle the specifics for that error, or if the developer adds nothing custom, a default dictionary is used to create an error with all necessary logging and debbugging info.
@codingispower1816
@codingispower1816 4 ай бұрын
Would be cool to see an example of this library.@@LarutanAK
@user-bb9cn6dg1u
@user-bb9cn6dg1u 3 ай бұрын
Damn, a good explanation no one is touching this depth of concepts like memory, handling error, and all stuff you are doing a great job!!
@prasannabiswas681
@prasannabiswas681 4 күн бұрын
This are some next level through experience gained codes which you are passing to new developers........with great power comes great responsibility Hats off to you I just got placed in a company after a system design interview for Fullstack Developer role just by following this playlist. Couldn't thank you more sir.
@fisherhe5030
@fisherhe5030 4 ай бұрын
Really helpful for me. Thanks, guy.
@Vriskh4oj
@Vriskh4oj 5 ай бұрын
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
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 5 ай бұрын
Let's goooo 🔥
@vmmoorthi
@vmmoorthi 2 ай бұрын
You are delivering crucial things Thank you
@enogratechnologies1896
@enogratechnologies1896 3 ай бұрын
Thanks for this.
@ayushpatel2171
@ayushpatel2171 Ай бұрын
Do we have to create our own error dictionary or is there some sort of npm package for it?
@dawid_dahl
@dawid_dahl 10 ай бұрын
Great video. Subscribed!
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 9 ай бұрын
Happy to have you here, Dawid!
@rajanacharya6360
@rajanacharya6360 9 ай бұрын
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.
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 9 ай бұрын
Thank you! Those are already on the list ;)
@bafian
@bafian 10 ай бұрын
you think it's okey to hardcode in the client side the httpCode ? or was this just an example and that httpCode property should only be used for network request errors?
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 10 ай бұрын
The latter! I hardcoded it just to demonstrate it as an example 😉
@bafian
@bafian 10 ай бұрын
@@SoftwareDeveloperDiaries haha oki dokis
@ayushpatel2171
@ayushpatel2171 Ай бұрын
I am unable to understand the importance of Object.setPrototypeOf(this, new.target.prototype). Can you please explain the significance of this line.
@acousticmunda6400
@acousticmunda6400 10 ай бұрын
OMG it is so helpful, I am feeling like a Pro now😅
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 10 ай бұрын
Happy to help 🫡
@scottamolinari
@scottamolinari 8 ай бұрын
It's pronounced walla"bee".
@SoftwareDeveloperDiaries
@SoftwareDeveloperDiaries 8 ай бұрын
Oh thanks for the hint 😅
Node.js Project Structure and Architecture Best Practices
7:38
Software Developer Diaries
Рет қаралды 20 М.
Error Handling in NodeJS (Complete Guide) | Node Tutorial
17:54
Nikita Dev
Рет қаралды 38 М.
Универ. 13 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:07:11
Комедии 2023
Рет қаралды 693 М.
Hate Try...Catch Error Handling in Node.js? Do This Instead
11:47
JavaScript Error Handling: 5 Things You Aren’t Thinking About!
14:42
Try Catch Error Handling With TypeScript
8:53
ByteGrad
Рет қаралды 6 М.
5 Async + Await Error Handling Strategies
18:11
Wes Bos
Рет қаралды 19 М.
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 21 МЛН
Iphone or nokia
0:15
rishton vines😇
Рет қаралды 997 М.
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 3,7 МЛН
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,9 МЛН