fail
Return fail
When processing is failure
return Result.fail<T, F>(/* your error message */);It do not throw error and return an object with error message and result status
const result = Result.fail<any>("error message");
console.log(result)
> Result {
isSuccess: false,
isFailure: true,
error: "error message",
_value: null,
statusCodeNumber: 422,
statusCode: "UNPROCESSABLE_ENTITY"
}
You can check if it has returned an error and also get the error message
const result = Result.fail<any>("error message");
console.log(result.isFailure)
> true
console.log(result.error)
> "error message"
Provide status for infra
Last updated
Was this helpful?