Getting started
Install fault and write your first Result.
Install
Install the dependency for each import path you use.
The core package has no runtime dependencies; zod >=4.0.0 is only needed for @thourum/fault/zod, drizzle-orm and pg for @thourum/fault/drizzle, and pg for @thourum/fault/pg.
Your first Result
A function that can fail returns Result<T, Fault> instead of throwing.
Mental model
Resultis synchronous;ResultAsyncis a thenable whose awaited value is aResult.and*methods run onOk;or*methods run onErr.Faultis the only error type you should ever put inE.