cli_abort: Signal an error, warning or message with a cli formatted...

Description Usage Arguments Examples

View source: R/rlang.R

Description

These functions let you create error, warning or diagnostic messages with cli formatting, including inline styling, pluralization and glue substitutions.

Usage

1
2
3
4
5

Arguments

message

It is formatted via a call to cli_bullets().

...

Passed to rlang::abort(), rlang::warn() or rlang::inform().

.envir

Environment to evaluate the glue expressions in.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
n <- "boo"
cli_abort(c(
        "{.var n} must be a numeric vector",
  "x" = "You've supplied a {.cls {class(n)}} vector."
))

len <- 26
idx <- 100
cli_abort(c(
        "Must index an existing element:",
  "i" = "There {?is/are} {len} element{?s}.",
  "x" = "You've tried to subset element {idx}."
))

## End(Not run)

RonMobile/cli documentation built on Dec. 18, 2021, 11 a.m.