Skip to content

API ReferenceErrorsFunction

getValidationErrorMessage()

function getValidationErrorMessage(error): string;

Returns a human-readable message for a validation error or issue.

Priority: issue.message (context-rich) → canonical MESSAGES map → fallback.

Accepts both ValidationIssue (new) and ValidationError (legacy). For ValidationError instances (which extend Error), the inherited message is the auto-generated [field] code — not user-friendly — so it is skipped in favor of the MESSAGES map.

Parameters

ParameterType
error| ValidationIssue | { code: | BaseValidationErrorType | ValidationErrorCode; message?: string; }

Returns

string