ia64/xen-unstable

changeset 7088:1e288a9316fd

Handle exceptions caused during processing of requests, to improve error
reporting.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Wed Sep 28 13:41:44 2005 +0100 (2005-09-28)
parents 46046d5fb354
children a65cdee92c0f
files tools/python/xen/web/SrvBase.py
line diff
     1.1 --- a/tools/python/xen/web/SrvBase.py	Tue Sep 27 22:09:46 2005 +0100
     1.2 +++ b/tools/python/xen/web/SrvBase.py	Wed Sep 28 13:41:44 2005 +0100
     1.3 @@ -81,7 +81,14 @@ class SrvBase(resource.Resource):
     1.4              req.write("Operation not implemented: " + op)
     1.5              return ''
     1.6          else:
     1.7 -            return op_method(op, req)
     1.8 +            try:
     1.9 +                res = op_method(op, req)
    1.10 +            except Exception, exn:
    1.11 +                log.exception("Request %s failed.", op)
    1.12 +                if req.useSxp():
    1.13 +                    return ['xend.err', "Exception: " + str(exn)]
    1.14 +                else:
    1.15 +                    return "<p>%s</p>" % str(exn)
    1.16  
    1.17      def print_path(self, req):
    1.18          """Print the path with hyperlinks.