liveBook · Manning

Error domain

As explained in Functional Design and Architecture: Examples in Haskell

An error domain is an isolated application part with a predefined error-handling mechanism and a guarantee that other error behavior will not occur within it.

When native error types are opaque or difficult to construct, application code becomes hard to test. Divide the application into error domains so each isolated part has a predefined error-handling mechanism and no competing error behavior. section 13.1.2

An error domain does not necessarily match one architectural layer: several layers may share a domain, and one layer may contain several domains. At every boundary, convert artifacts from one error representation into another. section 13.1.2 section 13.3

Native library boundary

A free-monadic application should not allow native errors or exceptions to leak into its pure language and scenarios. Let an interpreter mediate the boundary by converting native failures into an abstract representation; the interpreter may keep its own internal errors. section 13.1.2

Figure 13.2 Error domains

Use the error-domain diagram to trace how distinct error mechanisms are separated and where conversions occur. section 13.1.2

How Functional Design and Architecture: Examples in Haskell covers it

How deep it goes
Defines domain boundaries and conversion rules, then applies them to native errors, free monads, and interpreters.
Examples
Uses opaque native error types, native exceptions, free-monadic scenarios, interpreters, and boundary conversion as examples.
What it assumes
Assumes familiarity with application layers, errors, exceptions, and free monads; distinguishes error domains from domain errors.
What you can do after
Designs error boundaries that keep native failures from leaking into abstract or pure application logic.
How it connects
Connects error handling with architectural layers, free monads, interpreters, exceptions, and dependency inversion.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Design and Architecture: Examples in Haskell. The section links point to the parts of the book it draws on.