Skip to content
Snippets Groups Projects

DOC: Update tutorial on error handling

Merged Florian Spreckelsen requested to merge f-doc-errors into dev
1 file
+ 12
14
Compare changes
  • Side-by-side
  • Inline
+ 12
14
@@ -50,8 +50,12 @@ attributes and methods provided by the ``TransactionError``:
* ``entities``: a list of all entities that caused at least one error
in this transaction
* ``errors``: a list of all ``EntityError`` objects that occurred during
the transaction.
* ``errors``: a list of all ``EntityError`` objects that caused the
transaction to fail.
* ``all_entities``, ``all_errors``: sets of all entities and errors
that caused either this ``TransactionError`` or any of the
``EntityError`` objects it contains.
* ``has_error(error_t)``: Check whether an error of type ``error_t``
occurred during the transaction.
@@ -62,18 +66,12 @@ representation of all errors regarding the transaction in question.
EntityError
-----------
An ``EntityError`` represents a single error that has been returned by
the server. You might call \* ``get_entity()`` which returns the entity
which caused the error. \* ``get_description()`` which returns a
description of the error. \* ``get_code()`` which returns the error code
(if specified) or 0 (if not).
In fact, the ``EntityError`` class is a subclass of
``TransactionError``. So, it inherits the ``get_entities()``. Unless
overridden by subclasses of ``EntityError``, it return a list with only
one item—the entity which caused this error. Similarly, unless
overridden by subclasses, the ``get_errors()`` method returns a list
with only one item—``[self]``.
It is never raised on its own but is contained in a
``TransactionError`` (which may or may not contain other
``EntityError`` objects) which is then raised.
The ``EntityError`` is in fact a subclass of the ``TransactionError``
class.
Special Errors
~~~~~~~~~~~~~~
Loading