[capi-sig] Exceptions with additional instance variables

chojrak11 at gmail.com chojrak11 at gmail.com
Mon Dec 22 02:02:33 CET 2008


Hello,

I'm trying to implement custom exception that have to carry some
useful info by means of instance members, to be used like:

try:
    // some code
except MyException, data:
    // use data.errorcode, data.errorcategory, data.errorlevel,
data.errormessage and some others

The question is - how to implement the instance variables with
PyErr_NewException? Or should I use another approach? And how to set
values of these variables at the moment of exception? Should I use
PyErr_SetString or PyErr_SetObject?

I'm lost.

Thanks in advance.
Kind regards.


More information about the capi-sig mailing list