Repository F# setup
open System
open System.IO
open System.Threading
open System.Threading.Tasks
open Axial
open Axial.Layers
open Axial.Console
open Axial.FileSystem
open Axial.Hosting
open Axial.Hosting.Browser
open Axial.Hosting.Node
open Axial.HttpClient
open Axial.PlatformService
open Axial.Process
open Axial.State
open Axial.Telemetry
open Axial.Telemetry.JavaScriptError Handling
A Flow has a typed channel for failures the caller is expected to handle:
type PaymentError = CardDeclined | AccountClosed
let charge : Flow<PaymentError, Receipt> =
Flow.fail CardDeclinedFlow.die (InvalidOperationException "broken invariant")
Axial.Flowdie: exn -> Flow<'env,'error,'value>Creates a defective flow that fails with an exception. The exception representing the defect. A flow that always dies with the provided exception. This is the public constructor for non-domain defects. Use fail for expected typed failures and die when the workflow should surface a bug or panic.
``.ctor``: string -> unitInitializes a new instance of the class with a specified error message. The message that describes the error.
| Cause | Meaning |
|---|---|
Cause.Fail error |
Expected typed failure |
Cause.Die exception |
Unexpected defect |
Cause.Interrupt |
Cooperative cancellation or interruption |
Cause.Then (first, second) |
Sequentially combined causes |
Cause.Both (left, right) |
Concurrently combined causes |
Cause.Traced (cause, trace) |
Cause with diagnostic context |
Use an attempt constructor only when an exception from an interop API is an expected outcome. Use Flow.catch only
when the application deliberately translates a defect into a typed error.
Exit.toResult is intentionally lossy. Use it only at a boundary that has decided how defects, interruption, and
combined causes should be represented.
Learn more
- Bind explains how to assign or map an error at a
flow { }bind site. - Policy and verification explains reusable verification rules and
Flow.verify. - Defects covers exception capture and intentional recovery in detail.
- Cause reference lists cause transformations and rendering.
- Supervision explains how unjoined child defects are reported.

