All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: Ewan Mellor <ewan@xensource.com>, Kaleb Pederson <kibab@icehouse.net>
Subject: [PATCH] Expose exception thrown by xen.lowlevel.xc
Date: Fri, 19 May 2006 11:16:41 -0500	[thread overview]
Message-ID: <446DEF69.1010206@us.ibm.com> (raw)

[-- 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

             reply	other threads:[~2006-05-19 16:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-19 16:16 Anthony Liguori [this message]
2006-05-19 16:31 ` [PATCH] Expose exception thrown by xen.lowlevel.xc 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=446DEF69.1010206@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=ewan@xensource.com \
    --cc=kibab@icehouse.net \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.