python: The right exception is called, WmfsInitError instead of error.
a wmfs.WmfsInitError is available with a wmfs.WmfsInitError.message containing message error. In [2]: wmfs.init() --------------------------------------------------------------------------- WmfsInitError Traceback (most recent call last) /usr/home/marc/<ipython console> in <module>() WmfsInitError: WMFS not running? In [3]: try: ...: wmfs.init() ...: except wmfs.WmfsInitError, e: ...: print 'Error: '+e.message ...: Error: WMFS not running? Signed-off-by: Marc Lagrange <marc@shebang.sangor>
This commit is contained in:
@@ -189,10 +189,10 @@ initwmfs(void)
|
|||||||
if(m == NULL)
|
if(m == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WmfsInitError = PyErr_NewException("wmfs.error", NULL, NULL);
|
WmfsInitError = PyErr_NewException("wmfs.WmfsInitError", NULL, NULL);
|
||||||
|
|
||||||
Py_INCREF(WmfsInitError);
|
Py_INCREF(WmfsInitError);
|
||||||
PyModule_AddObject(m, "error", WmfsInitError);
|
PyModule_AddObject(m, "WmfsInitError", WmfsInitError);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
Reference in New Issue
Block a user