A wrapper around rlang::inform()
for providing feedback to developers using
this packages functions.
Arguments
- ...
Arguments passed on to
rlang::inform
message
The message to display, formatted as a bulleted list. The first element is displayed as an alert bullet prefixed with
!
by default. Elements named"*"
,"i"
,"v"
,"x"
, and"!"
are formatted as regular, info, success, failure, and error bullets respectively. See Formatting messages with cli for more about bulleted messaging.If a message is not supplied, it is expected that the message is generated lazily through
cnd_header()
andcnd_body()
methods. In that case,class
must be supplied. Onlyinform()
allows empty messages as it is occasionally useful to build user output incrementally.If a function, it is stored in the
header
field of the error condition. This acts as acnd_header()
method that is invoked lazily when the error message is displayed.class
Subclass of the condition.
body,footer
Additional bullets.
parent
Supply
parent
when you rethrow an error from a condition handler (e.g. withtry_fetch()
).If
parent
is a condition object, a chained error is created, which is useful when you want to enhance an error with more details, while still retaining the original information.If
parent
isNA
, it indicates an unchained rethrow, which is useful when you want to take ownership over an error and rethrow it with a custom message that better fits the surrounding context.Technically, supplying
NA
letsabort()
know it is called from a condition handler. This helps it create simpler backtraces where the condition handling context is hidden by default.
For more information about error calls, see Including contextual information with error chains.
use_cli_format
Whether to format
message
lazily using cli if available. This results in prettier and more accurate formatting of messages. Seelocal_use_cli()
to set this condition field by default in your package namespace.If set to
TRUE
,message
should be a character vector of individual and unformatted lines. Any newline character"\\n"
already present inmessage
is reformatted by cli's paragraph formatter. See Formatting messages with cli..inherit
Whether the condition inherits from
parent
according tocnd_inherits()
andtry_fetch()
. By default, parent conditions of higher severity are not inherited. For instance an error chained to a warning is not inherited to avoid unexpectedly catching an error downgraded to a warning..file
A connection or a string specifying where to print the message. The default depends on the context, see the
stdout
vsstderr
section..subclass
This argument was renamed to
class
in rlang 0.4.2 for consistency with our conventions for class constructors documented in https://adv-r.hadley.nz/s3.html#s3-subclassing..frequency
How frequently should the warning or message be displayed? By default (
"always"
) it is displayed at each time. If"regularly"
, it is displayed once every 8 hours. If"once"
, it is displayed once per session..frequency_id
A unique identifier for the warning or message. This is used when
.frequency
is supplied to recognise recurring conditions. This argument must be supplied if.frequency
is not set to"always"
.