These functions act as wrappers around rlang::abort()
and
rlang::warn()
to allow the glue
-style insertion of variables
names. By default, object names are parsed via substitute()
,
rather than evaluated, meaning that the objects do not need to be
coerced to strings. This is useful inside functions to grab the
variable name passed by the user
glue_abort(msg, ..., sub = T) glue_warn(msg, ..., sub = T)
msg | Message to be passed as either an error or a warning |
---|---|
... | additional arguments to be passed to |
sub | should the |
f <- function(input_argument) { glue_abort("Error is with {input_argument}") } x <- "Show My Name, Not My String" if (FALSE) { f(x) f("Show Me") }