You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sphinx/source/exceptions.rst
+119
Original file line number
Diff line number
Diff line change
@@ -87,3 +87,122 @@ The other thing to note is that if there are multiple calls to ``PyErr_SetString
87
87
return NULL;
88
88
}
89
89
90
+
---------------------------------
91
+
Creating Specialised Excpetions
92
+
---------------------------------
93
+
94
+
Often you need to create an Exception class that is specialised to a particular module. This can be done quite easily using either the ``PyErr_NewException`` or the ``PyErr_NewExceptionWithDoc`` functions. These create new exception classes that can be added to a module. For example:
95
+
96
+
97
+
.. code-block:: c
98
+
99
+
/* Exception types as statics to be initialised during module initialisation. */
0 commit comments