dont_stop: Run code without stopping

Description Usage Arguments Value Note See Also Examples

View source: R/utils.R

Description

Runs code without stopping for warnings or errors.

Usage

1
dont_stop(expr)

Arguments

expr

Code to execute.

Value

A list containing the results of evaluating each call in expr.

Note

This function is dangerous, since it overrides warnings and errors. Its intended use is for documenting examples of warnings and errors.

See Also

warning and stop for generating warnings and errors respectively; try and conditions for handling them.

Examples

1
2
3
4
5
6
7
8
dont_stop({
  warning("a warning")
  x <- 1
  stop("an error")
  y <- sqrt(exp(x + 1))
  assert_is_identical_to_true(y)
  y > 0
})

assertive.base documentation built on Feb. 8, 2021, 9:06 a.m.