throwExceptionIfNeeded static method

void throwExceptionIfNeeded(
  1. String? correlationId,
  2. List<ValidationResult> results,
  3. bool strict
)

Throws ValidationException based on errors in validation results. If validation results have no errors, than no exception is thrown.

  • correlationId (optional) transaction id to trace execution through call chain.
  • results list of validation results that may contain errors
  • strict true to treat warnings as errors.

See ValidationResult See ValidationException

Implementation

static void throwExceptionIfNeeded(
    String? correlationId, List<ValidationResult> results, bool strict) {
  var ex = ValidationException.fromResults(correlationId, results, strict);
  if (ex != null) throw ex;
}