Skip to content

Commit af8849f

Browse files
authored
docs: list all pybind11 exceptions (#2671)
* List all the pyind11 exceptions. For curious readers, see `translate_exception` and `PYBIND11_RUNTIME_EXCEPTION.
1 parent 2fa4747 commit af8849f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/advanced/exceptions.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,23 @@ at its exception handler.
4343
| | of bounds access in ``__getitem__``, |
4444
| | ``__setitem__``, etc.) |
4545
+--------------------------------------+--------------------------------------+
46-
| :class:`pybind11::value_error` | ``ValueError`` (used to indicate |
47-
| | wrong value passed in |
48-
| | ``container.remove(...)``) |
49-
+--------------------------------------+--------------------------------------+
5046
| :class:`pybind11::key_error` | ``KeyError`` (used to indicate out |
5147
| | of bounds access in ``__getitem__``, |
5248
| | ``__setitem__`` in dict-like |
5349
| | objects, etc.) |
5450
+--------------------------------------+--------------------------------------+
51+
| :class:`pybind11::value_error` | ``ValueError`` (used to indicate |
52+
| | wrong value passed in |
53+
| | ``container.remove(...)``) |
54+
+--------------------------------------+--------------------------------------+
55+
| :class:`pybind11::type_error` | ``TypeError`` |
56+
+--------------------------------------+--------------------------------------+
57+
| :class:`pybind11::buffer_error` | ``BufferError`` |
58+
+--------------------------------------+--------------------------------------+
59+
| :class:`pybind11::import_error` | ``import_error`` |
60+
+--------------------------------------+--------------------------------------+
61+
| Any other exception | ``RuntimeError`` |
62+
+--------------------------------------+--------------------------------------+
5563

5664
Exception translation is not bidirectional. That is, *catching* the C++
5765
exceptions defined above above will not trap exceptions that originate from

0 commit comments

Comments
 (0)