Рет қаралды 635
Ever wondered why error handling in JavaScript applications is so cumbersome and verbose? Could we do better? Could just we forget about all that try-catch stuff, ‘undefined’ is not an object and failed promises (pun intended), and at the same time have our app just work? Well, perhaps we could. Enter railway-oriented programming. It’s not a new paradigm or anything - it’s just a clever way to organize our code to be able to focus on the actual problem (the business logic), instead of endless error handling - and still have those errors handled nicely.
Agenda:
The Problem
The solution v.1.0 (without ROP)
The solution v.2.0 (with ROP)
Live example (PESEL number validation)
Questions