Error handling: doing it right!
summary
Covers concrete traps and fixes: throwing primitives loses stacks, promise constructors can swallow errors or double-resolve, unawaited async returns create unhandled rejections, and callbacks-without-errors hide failures. Shows tools and results: using util.promisify, checking promise hooks, enabling --unhandled-rejections=strict to turn warnings into crashes, and Node 12’s zero-cost async stack traces that surface real call sites. Demonstrates practical patterns: layered error classes, Express/fasthttp error handlers, and a retry strategy (backoff up to ten tries) for flaky outgoing APIs.
AI-written summary · about
chapters (11)
- 0:00Start
- 2:25Callbacks
- 28:53Why Do I Use Assert
- 29:37The Error Classes
- 31:03Abstract Error Modules
- 32:34Generic Error Handler for Express
- 36:01Databases
- 40:42Multiple Resource
- 47:02Summary
- 47:53Abstract Error Classes
- 50:33What Is the Best Way To Refactor Thralls in Promises To Cancel Them To Cancel Them
related talks
32mError handling: doing it right!
20mUnhandled rejections and other awaited promise tales
23mError Handling in Node.js
19mNode.js Error Handling
28mNo more pyramids -- Tools to keep callbacks neat
35mFun with async hooks and stack traces
30mNodeJS: Patterns and Tools to Ship to Production with Confidence
22mFrom Promises through Generators to async/await in node.js
