Class ValidationErrorItem

Validation Error Item Instances of this class are included in the ValidationError.errors property.

Hierarchy

  • ValidationErrorItem

Constructors

  • Creates a new ValidationError item. Instances of this class are included in the ValidationError.errors property.

    Parameters

    • message: string

      An error message

    • type: "notnull violation" | "string violation" | "unique violation" | "validation error" | "CORE" | "DB" | "FUNCTION"

      The type/origin of the validation error

    • path: string

      The field that triggered the validation error

    • value: string

      The value that generated the error

    • instance: Model<any, any>

      the DAO instance that caused the validation error

    • validatorKey: string

      a validation "key", used for identification

    • fnName: string

      property name of the BUILT-IN validator function that caused the validation error (e.g. "in" or "len"), if applicable

    • fnArgs: unknown[]

      parameters used with the BUILT-IN validator function, if applicable

    Returns ValidationErrorItem

Properties

instance: null | Model<any, any>

The DAO instance that caused the validation error

isValidationErrorItemOrigin: any
message: string

An error message

normalizeString: any
origin: null | "CORE" | "DB" | "FUNCTION"
path: null | string

The field that triggered the validation error

type: null | "notnull violation" | "string violation" | "unique violation" | "validation error"

The type/origin of the validation error

validatorArgs: unknown[]

Parameters used with the BUILT-IN validator function, if applicable

validatorKey: null | string

A validation "key", used for identification

validatorName: null | string

Property name of the BUILT-IN validator function that caused the validation error (e.g. "in" or "len"), if applicable

value: null | string

The value that generated the error

Deprecated

Will be removed in v7

TypeStringMap: typeof ValidationErrorItemType

Deprecated

Will be removed in v7

Methods

  • return a lowercase, trimmed string "key" that identifies the validator.

    Note: the string will be empty if the instance has neither a valid validatorKey property nor a valid validatorName property

    Throws

    thrown if NSSeparator is found to be invalid.

    Parameters

    • useTypeAsNS: boolean

      controls whether the returned value is "namespace", this parameter is ignored if the validator's type is not one of ValidationErrorItem.Origins

    • NSSeparator: string

      a separator string for concatenating the namespace, must be not be empty, defaults to "." (fullstop). only used and validated if useTypeAsNS is TRUE.

    Returns string

Generated using TypeDoc