failwith

0th

Percentile

Fail with specified value.

Modify a function so that it returns a default value when there is an error.

Keywords
debugging
Usage
failwith(default = NULL, f, quiet = FALSE)
Arguments
default

default value

f

function

quiet

all error messages be suppressed?

Value

a function

See Also

try_default

Aliases
  • failwith
Examples
library(dplyr) f <- function(x) if (x == 1) stop("Error!") else 1 f(1) f(2) safef <- failwith(NULL, f) safef(1) safef(2)
Documentation reproduced from package dplyr, version 0.5.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.