Error handling: doing it right! / Ruben Bridgewater

Description of the workshop (before)

SESSION

Error handling: doing it right!

A journey into the asynchronous debugging horrors, how to avoid them and what patterns can be used to ease the life of each developer debugging applications. We all have run into issues debugging JavaScript. Knowing what went wrong due to missing stack traces in asynchronous contexts and finding the actual issue takes way too long. Especially code with promises can be tedious to debug. Following best practices in error handling reduces debugging time and improves the code base a lot!

ABOUT RUBEN

Mainz, Germany

Ruben is a Node.js core collaborator and a freelance software architect consultant. His main emphasis is building powerful and easy to use APIs for scalable and fast applications. He is continuously working with the V8 team and the TC39 committee to improve the developer experience with JavaScript.

Must haves for the workshop

  • Promise have basically three states (Resolved, Rejected, Doing something)

  • Common issue is to send a wrong error-code to the Frontend, since we're not handling the right error status code

  • nest try try catch is a very bad idea, you should not do this

  • Good Practise is to create every new application with an own error class, extend this class with UserErrors and XXXError, than handle those Erros (see slides)

  • Use promisify in NodeJS instead to create a new own Promise

  • Refactor your code to use async/await as much as possible, its makes debugging so much easier and you'll love it

Video:

Screenshots:

Twitter: @homyasusina

Last updated

Was this helpful?