Skip to content
Snippets Groups Projects

DOC: Update tutorial on error handling

Merged Florian Spreckelsen requested to merge f-doc-errors into dev
1 unresolved thread
Error Handling
--------------
==============
HeartDBException
~~~~~~~~~~~~~~~~
In case of erroneus transactions, connection problems and a lot of
other cases, PyCaosDB may raise specific errors in order to pinpoint
the problem as precisly as possible. Some of these errors a
representations of errors in the CaosDB server, otheres stem from
problems that occurred on the client side.
The errors and exceptions are ordered hierarichally form the most
general exceptions to specific transaction or connection problems. The
most important error types and the hierarchy will be explained in the
following. For more information on specific error types, see also the
`source code
<https://docs.indiscale.com/caosdb-pylib/_apidoc/caosdb.html#module-caosdb.exceptions>`_.
.. note::
From PyCaosDB 0.5 and newer, the error handling has changed
significantly. New error classes have been introduced and the
behavior of ``TransactionError`` and ``EntityError`` has been
re-worked. In the following, only the "new" errors are
discussed. Please refer to the documentation of PyCaosDB 0.4.1 and
earlier for the old error handling.
CaosDBException
----------------
This is the most generic exception and all other error classes inherit
from this one. Because of its generality, it doesn't tell you much
except that some component of PyCaosDB raised an exception. If you
want to catch all possible CaosDB errors, this is the class to use.
TransactionError
~~~~~~~~~~~~~~~~
----------------
Every transaction (calling ``insert``, ``update``, ``retrieve``, or
``delete`` on a container or an entity) may finish with errors. They
@@ -24,7 +51,7 @@ Additionally, ``print(transaction_error`` prints a tree-like
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
Loading