The attached patch exposes the exception thrown by xen.lowlevel.xc as
the type xen.lowlevel.xc.Error which is an exception that inherits from
RuntimeError.
I only had a few minutes this morning so I didn't get to xen.lowlevel.xs
but hopefully someone else can use this as a guide on what needs to be
done. If noone else gets to it, I'll be able to submit another one in
about a week.
I've only done very basic testing but I don't expect that this should
break anything...
Regards,
Anthony Liguori
# HG changeset patch
# User Anthony Liguori <anthony@xxxxxxxxxxxxx>
# Node ID 352f6cc97066af5a50906a2c4b47794434a7cc30
# Parent 91c77df11b43894a2940b03029be46f6a1c85319
Expose the exceptions thrown by xen.lowlevel.xc so they can be caught.
Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
diff -r 91c77df11b43 -r 352f6cc97066 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed May 10 17:30:42 2006 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri May 19 11:13:28 2006 -0500
@@ -1172,7 +1172,7 @@ PyXc_init(XcObject *self, PyObject *args
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);
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|