liveBook · Manning

Functional error handling

As explained in Functional Programming in JavaScript

A programming approach that represents and propagates failures through composable functional abstractions instead of relying on exceptions and imperative control flow.

Functional error handling puts potentially hazardous values inside containers instead of exposing them directly or managing them with try-catch. Functions transform the contained value through mapping, preserving a safer and immutable boundary. section 5.2

Chaining wrapped transformations

const two = wrap(2); two.fmap(plus3).fmap(plus10); //-> Wrapper(15). The value stays inside its context while multiple operations are composed.

How Functional Programming in JavaScript covers it

How deep it goes
Defines Wrapper, map, fmap, and chaining, but stops short of presenting a complete error-specific data type.
Examples
Demonstrates wrapped strings, null values, arithmetic chaining, identity extraction, and logging through fmap.
What it assumes
Assumes familiarity with JavaScript functions, arrays’ map method, and the identity function.
What you can do after
Apply it via Wrapper, fmap, and map to transform and inspect values without direct access.
How it connects
Connects functional error handling to functors, map, immutability, referential transparency, and try-catch.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.