aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremellor@ewan <emellor@ewan>2005-09-28 13:41:44 +0100
committeremellor@ewan <emellor@ewan>2005-09-28 13:41:44 +0100
commitd391a2dddc20e4b8199b07f52e224eab60812c69 (patch)
tree3846ca257a13260e4d74010f68b8a72227bd570c
parent817fbb643280d4194c1933a2159a5a14fe4c29c8 (diff)
downloadxen-d391a2dddc20e4b8199b07f52e224eab60812c69.tar.gz
xen-d391a2dddc20e4b8199b07f52e224eab60812c69.tar.bz2
xen-d391a2dddc20e4b8199b07f52e224eab60812c69.zip
Handle exceptions caused during processing of requests, to improve error
reporting. Signed-off-by: Ewan Mellor <ewan@xensource.com>
-rw-r--r--tools/python/xen/web/SrvBase.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/python/xen/web/SrvBase.py b/tools/python/xen/web/SrvBase.py
index 49a9e058d1..e0b528fcc0 100644
--- a/tools/python/xen/web/SrvBase.py
+++ b/tools/python/xen/web/SrvBase.py
@@ -81,7 +81,14 @@ class SrvBase(resource.Resource):
req.write("Operation not implemented: " + op)
return ''
else:
- return op_method(op, req)
+ try:
+ res = op_method(op, req)
+ except Exception, exn:
+ log.exception("Request %s failed.", op)
+ if req.useSxp():
+ return ['xend.err', "Exception: " + str(exn)]
+ else:
+ return "<p>%s</p>" % str(exn)
def print_path(self, req):
"""Print the path with hyperlinks.