Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "User-friendly error reporting" example #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,10 @@ instead of a built-in one.

.. code:: python

>>> Schema(Use(int, error='Invalid year')).validate('XVII')
>>> Schema(Use(int, error='Invalid year {}')).validate('XVII')
Traceback (most recent call last):
...
schema.SchemaError: Invalid year
schema.SchemaError: Invalid year XVII

You can see all errors that occurred by accessing exception's ``exc.autos``
for auto-generated error messages, and ``exc.errors`` for errors
Expand All @@ -469,6 +469,7 @@ You can exit with ``sys.exit(exc.code)`` if you want to show the messages
to the user without traceback. ``error`` messages are given precedence in that
case.


A JSON API example
-------------------------------------------------------------------------------

Expand Down