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

Hierarchy

Constructors

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

    Parameters

    • message: string

      An error message

    • type: "CORE" | "DB" | "FUNCTION" | "DATATYPE" | "notNull violation" | "unique violation" | "Validation error"

      The type/origin of the validation error

    • Optional path: string

      The field that triggered the validation error

    • Optional value: string

      The value that generated the error

    • Optional instance: Model<any, any>

      the DAO instance that caused the validation error

    • Optional validatorKey: string

      a validation "key", used for identification

    • Optional fnName: string

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

    • Optional 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

origin: null | "CORE" | "DB" | "FUNCTION" | "DATATYPE"
path: null | string

The field that triggered the validation error

type: null | "notNull 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: unknown

The value that generated the error

Origins: typeof ValidationErrorItemOrigin = ValidationErrorItemOrigin

Deprecated

Will be removed in v7

TypeStringMap: typeof ValidationErrorItemType = 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

    Parameters

    • useTypeAsNS: false

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

    Returns string

    Throws

    thrown if NSSeparator is found to be invalid.

  • Parameters

    • Optional useTypeAsNS: true

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

    • Optional 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

  • Parameters

    • origin: "CORE" | "DB" | "FUNCTION" | "DATATYPE" | "notNull violation" | "unique violation" | "Validation error"

    Returns origin is "CORE" | "DB" | "FUNCTION" | "DATATYPE"