assert_that: Scoped Assertions

Description Usage Arguments

Description

The pkgcond package intentionally overrides the assertthat::assert_that() function. It provides the same utility but enhances the original version by throwing scoped and typed errors. The type is 'assertion failure' and the scope can be set or inferred from the calling frame.

Usage

1
2
3
4
5
6
7
assert_that(
  ...,
  env = parent.frame(),
  msg = NULL,
  scope = find_scope(env),
  type = "assertion failure"
)

Arguments

...

unnamed expressions that describe the conditions to be tested. Rather than combining expressions with &&, separate them by commas so that better error messages can be generated.

env

(advanced use only) the environment in which to evaluate the assertions.

msg

a custom error message to be printed if one of the conditions is false.

scope

The scope of the error.

type

The error type.


pkgcond documentation built on April 28, 2021, 9:06 a.m.