Error handling: doing it right!
summary
Shows that missing async stacks and swallowed rejections cause most debugging pain and that Node 12+ restores call sites with zero-cost async stack traces. Recommends concrete fixes: use util.promisify instead of manual Promise constructors, switch unhandled-rejection to throw so the process exits, publish shared application error classes in a private module, and add a retry-with-delay for flaky APIs (Facebook Graph returned error code 1200 about 25% of the time) which materially improves reliability.
AI-written summary · about
chapters (12)
- 0:00Intro
- 1:44Callbacks
- 2:16Promises
- 5:08Primitive errors
- 8:28Nested try / catch
- 12:47Unhandled rejections
- 13:33Error classes
- 17:42Express
- 21:16Requests
- 22:50util.promisify
- 24:48Async Stack traces
- 26:01Summary / Rules
related talks
32mError handling: doing it right!
20mUnhandled rejections and other awaited promise tales
27mGetting the Most out of JavaScript Errors
25mDebugging async JS
22mHave You Heard the Joke About Async Debugging? I Promise It Is Good
40mManeuvering Errors within the Bowels of JavaScript
25mNow and .then: Debugging Async JavaScript
26mNow and .then: Debugging Async JS
