summaryrefslogtreecommitdiff
path: root/docs/validate.rst
diff options
context:
space:
mode:
authorChase Sterling <chase.sterling@gmail.com>2013-03-02 01:42:53 -0500
committerChase Sterling <chase.sterling@gmail.com>2013-03-02 01:42:53 -0500
commitf56c41e94ae9d0cadccdc32947242d9c6fd9f119 (patch)
treeb74423057df00a45d565f71f2047ae11c8b3eaae /docs/validate.rst
parent741dced6c9339e7e63c5b241d6bfa73bd047eb84 (diff)
downloadjsonschema-f56c41e94ae9d0cadccdc32947242d9c6fd9f119.tar.gz
Allow exception types to be registered for format functions
These exceptions will be caught and message will be used for the ValidationError
Diffstat (limited to 'docs/validate.rst')
-rw-r--r--docs/validate.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/validate.rst b/docs/validate.rst
index b4faa80..2a30f0e 100644
--- a/docs/validate.rst
+++ b/docs/validate.rst
@@ -238,12 +238,13 @@ be enabled by hooking in a format-checking object into an :class:`IValidator`.
.. attribute:: checkers
- A mapping of currently known formats to functions that validate them.
- New checkers can be added and removed either per-instance or globally
- for all checkers using the :meth:`FormatChecker.checks` or
+ A mapping of currently known formats to tuple of functions that
+ validate them and errors that should be caught. New checkers can be
+ added and removed either per-instance or globally for all checkers
+ using the :meth:`FormatChecker.checks` or
:meth:`FormatChecker.cls_checks` decorators respectively.
- .. method:: cls_checks(format)
+ .. method:: cls_checks(format, raises=None)
Register a decorated function as *globally* validating a new format.
@@ -251,6 +252,8 @@ be enabled by hooking in a format-checking object into an :class:`IValidator`.
supplied checker.
:argument str format: the format that the decorated function will check
+ :argument raises: Exception that will be caught and used as the
+ error message