The type of the error
The error object to wrap in an error result
A Result object representing failure with the given error
const result = err(new Error("Something went wrong"))
if (!result.ok) {
console.log(result.error.message) // "Something went wrong"
}
// With DomainError (2.1.0+)
import { fileNotFound } from '@jenova-marie/ts-rust-result/errors'
const result = err(fileNotFound('/missing.txt'))
// result.error is typed as FileNotFoundError
Creates an error result with the given error.