Session

Floating and Sinking Promises: Let's Fix Your Broken Async Code

Promises and async/await are the right way to work with asynchronous code in Node.js. They're also both the easiest code constructs to introduce bugs with -- and can be some of the hardest code to debug. We'll walk through:

* Refactoring pre-Promise callback hell to Promises
* Refactoring pre-async/await Promises to async/await
* Debugging with console logs and node --inspect
* "Floating" Promises (those created and not handled): detection with TypeScript ESLint, and error handling
* "Sinking" Promises (those created and handled improperly): detection with TypeScript ESLint, and error handling

Each of those classifications off issues will be resolved in three steps:
1. We'll look at how their need can develop in even the most type-safe, well-architected, well-intended projects
2. We'll see how to detect those issues - as bugs and/or development-time smells
3. We'll see how tools in TypeScript and/or typescript-eslint can detect them for us, and sometimes even automate the fixes.

By the end of this workshop, you'll be fully prepared to debug even the gnarliest asynchronous shenanigans and write production quality asynchronous code.

Josh Goldberg

Open Source Developer

Philadelphia, New York, United States

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top