Tcl Library Source Code

Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


valtype::common - Validation, common code

Table Of Contents


package require Tcl 8.5
package require valtype::common ?1?

valtype::common::reject code text
valtype::common::badchar code ?text?
valtype::common::badcheck code ?text?
valtype::common::badlength code lengths ?text?
valtype::common::badprefix code prefixes ?text?


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 Error Codes.


Error Codes

The errors thrown by the commands of this package all use the -errorcode INVALID 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 -errorCode__s which can be thrown by this package are shown below, with __<> a placeholder for both the caller-supplied type-information, the type description.

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 Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, 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.


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


Validation, Type checking


Copyright © 2011 Andreas Kupries