Learn R Programming

climatehealth (version 1.0.0)

abort_validation: Raise a validation error (data/parameter issues)

Description

Use this for general validation failures where the user's input or data doesn't meet requirements. For missing columns specifically, use abort_column_not_found().

Usage

abort_validation(message, ..., call = rlang::caller_env())

Value

Never returns; always raises an error.

Arguments

message

Human-readable error message

...

Additional metadata (e.g., param = "nlag", value = -1)

call

The call to include in the error

Examples

Run this code
# \donttest{
# Parameter validation
nlag <- -1
if (nlag < 0) {
  err <- tryCatch(
    abort_validation(
      "nlag must be >= 0",
      param = "nlag",
      value = nlag,
      expected = "non-negative integer"
    ),
    error = identity
  )
  inherits(err, "validation_error")
}
# }

Run the code above in your browser using DataLab