Skip to contents

[Stable]

Usage

Failure(error = NULL)

Arguments

error

An error value to wrap. Could be a numeric error code, a string with a message or a condition object.

See also

Success(), which wraps a value to provide the context of a successful computation.

Examples

Failure("The computation failed")
#> <resultr::Failure>
#>  @ error: chr "The computation failed"
Failure("Argument x must be numeric")
#> <resultr::Failure>
#>  @ error: chr "Argument x must be numeric"
Failure(rlang::catch_cnd(stop("An error was thrown")))
#> <resultr::Failure>
#>  @ error:List of 2
#>  .. $ message: chr "An error was thrown"
#>  .. $ call   : language force(expr)
#>  .. - attr(*, "class")= chr [1:3] "simpleError" "error" "condition"