| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/promise.R |
| 3 |
\name{promise_resolve} |
| 4 |
\alias{promise_resolve} |
| 5 |
\alias{promise_reject} |
| 6 |
\title{Create a resolved or rejected promise} |
| 7 |
\usage{ |
| 8 |
promise_resolve(value) |
| 9 |
|
| 10 |
promise_reject(reason) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{value}{A value, or promise, that the new promise should be resolved to. |
| 14 |
This expression will be lazily evaluated, and if evaluating the expression |
| 15 |
raises an error, then the new promise will be rejected with that error as |
| 16 |
the reason.} |
| 17 |
|
| 18 |
\item{reason}{An error message string, or error object.} |
| 19 |
} |
| 20 |
\description{ |
| 21 |
Helper functions to conveniently create a promise that is resolved to the |
| 22 |
given value (or rejected with the given reason). |
| 23 |
} |
| 24 |
\examples{ |
| 25 |
promise_resolve(mtcars) |> |
| 26 |
then(head) |> |
| 27 |
then(print) |
| 28 |
|
| 29 |
promise_reject("Something went wrong") |> |
| 30 |
catch(tee = TRUE, \(e) message(conditionMessage(e))) |
| 31 |
|
| 32 |
} |