All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Expose exception thrown by xen.lowlevel.xc
@ 2006-05-19 16:16 Anthony Liguori
  2006-05-19 16:31 ` Ewan Mellor
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2006-05-19 16:16 UTC (permalink / raw)
  To: xen-devel; +Cc: Ewan Mellor, Kaleb Pederson

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

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

[-- Attachment #2: xc-lowlevel-exc.diff --]
[-- Type: text/plain, Size: 1358 bytes --]

# HG changeset patch
# User Anthony Liguori <anthony@codemonkey.ws>
# Node ID 352f6cc97066af5a50906a2c4b47794434a7cc30
# Parent  91c77df11b43894a2940b03029be46f6a1c85319
Expose the exceptions thrown by xen.lowlevel.xc so they can be caught.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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);
 }
 
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-01 11:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-19 16:16 [PATCH] Expose exception thrown by xen.lowlevel.xc Anthony Liguori
2006-05-19 16:31 ` Ewan Mellor
2006-05-19 16:35   ` [PATCH] Expose exception thrown by xen.lowlevel.xs (Was Re: [PATCH] Expose exception thrown by xen.lowlevel.xc) Anthony Liguori
2006-05-19 19:44     ` Kaleb Pederson
2006-06-01 11:13     ` Ewan Mellor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.