mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
docs: list all pybind11 exceptions (#2671)
* List all the pyind11 exceptions. For curious readers, see `translate_exception` and `PYBIND11_RUNTIME_EXCEPTION.
This commit is contained in:
parent
2fa4747cd4
commit
af8849f47e
@ -43,15 +43,23 @@ at its exception handler.
|
|||||||
| | of bounds access in ``__getitem__``, |
|
| | of bounds access in ``__getitem__``, |
|
||||||
| | ``__setitem__``, etc.) |
|
| | ``__setitem__``, etc.) |
|
||||||
+--------------------------------------+--------------------------------------+
|
+--------------------------------------+--------------------------------------+
|
||||||
| :class:`pybind11::value_error` | ``ValueError`` (used to indicate |
|
|
||||||
| | wrong value passed in |
|
|
||||||
| | ``container.remove(...)``) |
|
|
||||||
+--------------------------------------+--------------------------------------+
|
|
||||||
| :class:`pybind11::key_error` | ``KeyError`` (used to indicate out |
|
| :class:`pybind11::key_error` | ``KeyError`` (used to indicate out |
|
||||||
| | of bounds access in ``__getitem__``, |
|
| | of bounds access in ``__getitem__``, |
|
||||||
| | ``__setitem__`` in dict-like |
|
| | ``__setitem__`` in dict-like |
|
||||||
| | objects, etc.) |
|
| | objects, etc.) |
|
||||||
+--------------------------------------+--------------------------------------+
|
+--------------------------------------+--------------------------------------+
|
||||||
|
| :class:`pybind11::value_error` | ``ValueError`` (used to indicate |
|
||||||
|
| | wrong value passed in |
|
||||||
|
| | ``container.remove(...)``) |
|
||||||
|
+--------------------------------------+--------------------------------------+
|
||||||
|
| :class:`pybind11::type_error` | ``TypeError`` |
|
||||||
|
+--------------------------------------+--------------------------------------+
|
||||||
|
| :class:`pybind11::buffer_error` | ``BufferError`` |
|
||||||
|
+--------------------------------------+--------------------------------------+
|
||||||
|
| :class:`pybind11::import_error` | ``import_error`` |
|
||||||
|
+--------------------------------------+--------------------------------------+
|
||||||
|
| Any other exception | ``RuntimeError`` |
|
||||||
|
+--------------------------------------+--------------------------------------+
|
||||||
|
|
||||||
Exception translation is not bidirectional. That is, *catching* the C++
|
Exception translation is not bidirectional. That is, *catching* the C++
|
||||||
exceptions defined above above will not trap exceptions that originate from
|
exceptions defined above above will not trap exceptions that originate from
|
||||||
|
Loading…
Reference in New Issue
Block a user