@effect-ts/system
Version:
Effect-TS is a zero dependency set of libraries to write highly productive, purely functional TypeScript at scale.
21 lines (17 loc) • 601 B
text/typescript
// ets_tracing: off
import * as C from "../Cause/cause.js"
import { haltWith } from "./core.js"
/**
* Returns an effect that models failure with the specified error.
* The moral equivalent of `throw` for pure code.
*/
export function fail<E>(e: E, __trace?: string) {
return haltWith((trace) => C.traced(C.fail(e), trace()), __trace)
}
/**
* Returns an effect that models failure with the specified error.
* The moral equivalent of `throw` for pure code.
*/
export function failWith<E>(e: () => E, __trace?: string) {
return haltWith((trace) => C.traced(C.fail(e()), trace()), __trace)
}