logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

valtype::common - Validation, common code

Api

valtype::common::rejectcodetext
              The  core  command  of  this package it throws an INVALID error with the specified text. The first
              argument is a list of codes extending the INVALID with detail information.

       valtype::common::badcharcode ?text?
              This command throws an INVALIDCHAR error with the specified text. The first argument is a list of
              codes providing details. These are inserted between the codes INVALID and CHARACTER.

       valtype::common::badcheckcode ?text?
              This command throws an INVALIDCHECK-DIGIT error with the specified text, if any, extended by  the
              standard  text  "the  check  digit  is incorrect". The first argument is a list of codes providing
              details. These are inserted between the codes INVALID and CHECK_DIGIT.

       valtype::common::badlengthcodelengths ?text?
              This command throws an INVALIDLENGTH error with the specified  text,  if  any,  extended  by  the
              standard text "incorrect length, expected ... character(s)". The first argument is a list of codes
              providing  details.  These are inserted between the codes INVALID and LENGTH. The argument lengths
              is a list of the input lengths which had been expected, i.e. these are the valid lengths.

       valtype::common::badprefixcodeprefixes ?text?
              This command throws an INVALIDPREFIX error with the specified  text,  if  any,  extended  by  the
              standard  text  "incorrect  prefix, expected ...". The first argument is a list of codes providing
              details.  These are inserted between the codes INVALID and PREFIX. The argument prefixes is a list
              of the input prefixes which had been expected, i.e. these are the valid prefixes.

Bugs, Ideas, Feedback

       This document, and the package it describes, will undoubtedly contain bugs and  other  problems.   Please
       report  such  in  the  category  valtype  of  the TcllibTrackers [http://core.tcl.tk/tcllib/reportlist].
       Please also report any ideas for enhancements you may have for either package and/or documentation.

       When proposing code changes, please provide unifieddiffs, i.e the output of diff-u.

       Note further that attachments are strongly preferred over inlined patches. Attachments  can  be  made  by
       going  to the Edit form of the ticket immediately after its creation, and then using the left-most button
       in the secondary navigation bar.

Category

       Validation, Type checking

Description

       This  package  implements  a number of common commands used by the validation types in this module. These
       commands essentially encapsulate the throwing of validation errors, ensuring that a proper -errorcode  is
       used. See section ErrorCodes.

Error Codes

       The errors thrown by the commands of this package all use the -errorcodeINVALID to distinguish the input
       validation failures they represent from package internal errors.

       To provide more detailed information about why the validation failed the -errorCode goes actually  beyond
       that.   First,  it will contain a code detailing the type itself. This is supplied by the caller. This is
       then followed by values detailing the reason for the failure. The full set of -errorCodes  which  can  be
       thrown  by  this  package  are  shown  below,  with  <>  a placeholder for both the caller-supplied type-
       information, the type description.

       INVALID <> CHARACTER
              The input value contained one or more bad characters, i.e. characters which must not occur in  the
              input for it to be a <>.

       INVALID <> CHECK-DIGIT
              The  check digit of the input value is wrong. This usually signals a data-entry error, with digits
              transposed, forgotten, etc. Of course, th input may be an outright fake too.

       INVALID <> LENGTH
              The input value is of the wrong length to be a <>.

       INVALID <> PREFIX
              The input value does not start with the magic value(s) required for it to be a <>.

Keywords

       Checking, Testing, Type checking, Validation, Value checking, isA

Name

       valtype::common - Validation, common code

Synopsis

       package require Tcl8.59

       package require valtype::common?1.1?valtype::common::rejectcodetextvaltype::common::badcharcode ?text?

       valtype::common::badcheckcode ?text?

       valtype::common::badlengthcodelengths ?text?

       valtype::common::badprefixcodeprefixes ?text?

________________________________________________________________________________________________________________

See Also