Skip to contents

Internal helpers for constructing structured nhsbsa error, warning and informational conditions.

Usage

nhsbsa_abort(
  message,
  class = NULL,
  ...,
  call = rlang::caller_env(),
  .envir = rlang::caller_env()
)

nhsbsa_warn(message, class = NULL, ..., .envir = rlang::caller_env())

nhsbsa_inform(message, class = NULL, ..., .envir = rlang::caller_env())

Arguments

message

It is formatted via a call to cli_bullets().

class

Optional character vector of additional classes to prepend before the nhsbsa base class.

...

Passed through to the underlying cli signalling function.

call

Call environment (only used by nhsbsa_abort()).

.envir

Environment to evaluate the glue expressions in.

Details

These wrap the corresponding cli signalling functions (cli::cli_abort(), cli::cli_warn(), cli::cli_inform()) and always append an nhsbsa-specific base class (nhsbsa_error, nhsbsa_warning, nhsbsa_message).

Additional custom classes may be optionally prepended via the class argument, allowing callers to test for and handle specific conditions programmatically.

The original named cli message vector is stored in cli_message so a condition can be re-thrown to reproduce an identical message.