Documentation
    Preparing search index...

    Class ValidationErrorItem

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

    Hierarchy

    • Error
      • ValidationErrorItem
    Index
    • 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

      • Optionalpath: string

        The field that triggered the validation error

      • Optionalvalue: string

        The value that generated the error

      • Optionalinstance: Model<any, any>

        the DAO instance that caused the validation error

      • OptionalvalidatorKey: string

        a validation "key", used for identification

      • OptionalfnName: string

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

      • OptionalfnArgs: unknown[]

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

      Returns ValidationErrorItem

    instance: Model<any, any> | null

    The DAO instance that caused the validation error

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

    The field that triggered the validation error

    type: "notNull violation" | "unique violation" | "Validation error" | null

    The type/origin of the validation error

    validatorArgs: unknown[]

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

    validatorKey: string | null

    A validation "key", used for identification

    validatorName: string | null

    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

    Will be removed in v7

    TypeStringMap: typeof ValidationErrorItemType = ValidationErrorItemType

    Will be removed in v7

    • 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

      thrown if NSSeparator is found to be invalid.

    • Parameters

      • OptionaluseTypeAsNS: true

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

      • OptionalNSSeparator: 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