format_error_call {rlang}R Documentation

Validate and format a function call for use in error messages

Description

Usage

format_error_call(call)

error_call(call)

Arguments

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

Either a string formatted as code or NULL if a simple call could not be generated.

Details of formatting

Examples

# Arguments are stripped
writeLines(format_error_call(quote(foo(bar, baz))))

# Returns `NULL` with complex calls such as those that contain
# inlined functions
format_error_call(call2(list))

# Operators are formatted using their names rather than in
# function call form
writeLines(format_error_call(quote(1 + 2)))

[Package rlang version 1.0.6 Index]