Dmitry Makhnev & Artem Kobzar

Unexpected monad. Is safe error handling possible in JavaScript/TypeScript?

Error handling is an extremely hard part of every JavaScript project that can produce a lot of bugs. Usually, developers use just the try/catch as a standard approach for the error handling, which is not so ideal solution because this statement catches anything which was thrown by the “throw” statement, as results developer:

  • need extra conditions for handling restricted classes of exceptions;
  • should rethrow errors or it can be eaten up;
  • can’t separate errors and exceptions;

In this talk, you’ll learn how to implement safe error handling (without mentioned problems) in a project and with perks like typed errors inside handlers, errors documentation of functions/methods without JSDoc and comments, and the ability to log your errors without a break of the error handling flow.

Dmitry is a frontend developer of site, mentor in frontend section, organizer of LongestJS meetup, ex-member of HolyJS conference selection committee.

Tom is a software engineer working on Kotlin/JS compiler and infrastructure in JetBrains. Also, he is the creator of Hegel.js, mentor in JavaScript.Ninja courses, ex-organizer of HolyJS conference, and presenter of UnderJS podcast.