Skip to content

Validation failures

Source: R/errors.R ยท Help: ?validation_error

validation_error() reports a value that fails a rule: the payload is wrong, so it is classified as permanent and not retryable for the same unchanged input.

Usage

validation_error(field, value, message = NULL, parent = NULL, call = NULL)

Arguments

field
Name of the field that failed validation.
value
The offending value. Stored as given; rendered in the default message with deparse().
message
A message to use instead of the default.
parent
The condition that caused this one, or NULL.
call
The call to report, or NULL.

Value

A condition of class dataexcept_validation_error.

Examples

check_age <- function(age) {
  if (age < 0) stop(validation_error("age", age))
  age
}
tryCatch(check_age(-1), dataexcept_validation_error = function(e) e$field)

See also

Other dataexcept errors: data_engineering_errors, data_frame_errors, data_quality_errors, file_errors, job_errors, model_quality_errors, modelling_errors, pipeline_errors, service_errors