mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
Expose the exceptions thrown by xen.lowlevel.xc so they can be caught.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
1 parent
71fd91f9ba
commit
0111c4bb06
1 file changed
+5
-2
@@ -1172,7 +1172,7 @@ static int
|
||||
PyXc_init(XcObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
if ((self->xc_handle = xc_interface_open()) == -1) {
|
||||
PyErr_SetFromErrno(PyExc_RuntimeError);
|
||||
PyErr_SetFromErrno(xc_error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1245,7 +1245,7 @@ PyMODINIT_FUNC initxc(void)
|
||||
if (m == NULL)
|
||||
return;
|
||||
|
||||
xc_error = PyErr_NewException(PKG ".error", NULL, NULL);
|
||||
xc_error = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL);
|
||||
zero = PyInt_FromLong(0);
|
||||
|
||||
/* KAF: This ensures that we get debug output in a timely manner. */
|
||||
@@ -1254,6 +1254,9 @@ PyMODINIT_FUNC initxc(void)
|
||||
|
||||
Py_INCREF(&PyXcType);
|
||||
PyModule_AddObject(m, CLS, (PyObject *)&PyXcType);
|
||||
|
||||
Py_INCREF(xc_error);
|
||||
PyModule_AddObject(m, "Error", xc_error);
|
||||
}
|
||||
|
||||
|
||||
|
||||