[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Expose the exceptions thrown by xen.lowlevel.xc so they can be caught.



# HG changeset patch
# User Anthony Liguori <anthony@xxxxxxxxxxxxx>
# Node ID ae0175bf063134388b0e1323841cc688339c0095
# Parent  9b11eeab4558a43c7c6f979d7e231f3245e6ce71
Expose the exceptions thrown by xen.lowlevel.xc so they can be caught.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
---
 tools/python/xen/lowlevel/xc/xc.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -r 9b11eeab4558 -r ae0175bf0631 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri May 19 16:30:21 2006 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri May 19 17:31:28 2006 +0100
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.