Overview
TheerrAsync function constructs a ResultAsync containing an Err variant with the provided error value.
Signature
E
required
The error value to wrap in a ResultAsync
ResultAsync<T, E> - A ResultAsync containing the Err value
Usage
Basic usage
Async error handling
Custom error types
When to use
- Returning an error from an async operation
- Early returns in validation chains
- Converting error states to ResultAsync for consistency
Related
okAsync
Create an Ok variant of ResultAsync
ResultAsync.fromPromise
Handle rejecting Promises