Skip to contents

This function returns a standard error message for NULL parameters that are not allowed to be NULL, i.e. if null_valid = FALSE.

Usage

dis_null(x, class, null_valid, param = rlang::caller_arg(x),
    call = rlang::caller_env(), fact_check = "global")

Arguments

x

Required object; a parameter argument to test.

class

Required character scalar; the expected type of the parameter.

null_valid

Required logical scalar; whether the parameter can be NULL. If FALSE, the function will throw an error if x is NULL. If TRUE, the function will not throw an error if x is NULL.

param

Required character scalar; the parameter name. The default uses rlang::caller_arg(x) to pull the parameter name passed to x by the function dis_null() is nested within. This value can also be set to a static character scalar.

call

Required environment; the environment in which the function was called. If nesting dis_not_missing 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.

fact_check

Required character scalar; whether to override fact checking environment setting. If "global" (default), dis_character will follow the global setting. If "always", dis_character will ignore any global setting and will always check x. This argument is primarily intended for Shiny developers who wish to use disputeR in modules. See the vignette on vignette("developing", package = "disputeR") for details on how to use this function.

Value

This function will return an error message for NULL parameters that are not allowed to be NULL. Otherwise, no output is returned.

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.