Skip to contents

Create the default message used when an object passed to an environment parameter does not have the correct class.

Usage

dis_msg_env(x, param = "call", call = rlang::caller_env())

Arguments

x

Required object; a parameter argument to test.

param

Required character scalar; the parameter name. The default matches the argument named for environments used through disputeR.

call

Required environment; the environment in which the function was called. If nesting dis_msg_class() within another function, it is recommended to provide the calling environment to ensure the correct environment is referenced using rlang::caller_env() (default). If there are multiple levels of nesting, the call argument can be used to pass an environment created in the outermost function.

Value

A character string with the default message.

Details

See the vignette on vignette("developing", package = "disputeR") for details about internal validation of arguments for this function. Unlike the core functions, dis_param does not have a fact_check argument. The vignette("developing", package = "disputeR") vignette includes details on how to implement that functionality around dis_param.

Examples

dis_msg_env(x = "character", param = "call")
#>                                                                            
#> "{.arg {call}} must be an environment object, not a {.cls {class(call)}}." 
#>                                                                          i 
#>                                "Provide an environment object for {.arg {" 
#>                                                                            
#>                                                                     "call" 
#>                                                                            
#>                                                                      "}}."