Stores the result of the given Promise into a Result. If the promise fails, Err is returned. If the promise succeeds, Ok is returned.
const res = await tryp(fetch("/my/api")).mapErr((err) => apiError(err))if (res.isErr()) { return err(res.error)} Copy
const res = await tryp(fetch("/my/api")).mapErr((err) => apiError(err))if (res.isErr()) { return err(res.error)}
Stores the result of the given Promise into a Result. If the promise fails, Err is returned. If the promise succeeds, Ok is returned.