lanka-validations - v2.1.0
    Preparing search index...

    Function createFailure

    • Helper to construct a failed ValidationResult

      Type Parameters

      • T = unknown

      Parameters

      • error: string

        English error message.

      • code: string = 'VALIDATION_FAILED'

        Stable error code. Defaults to 'VALIDATION_FAILED'.

      • Optionalerrors: string[]

        All messages. Defaults to [error].

      Returns ValidationResult<T>

      A failed ValidationResult.

      createFailure('Too short', 'NAME_TOO_SHORT').code; // 'NAME_TOO_SHORT'