X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/504587ddf79685559107c75721bf45a00bf8210c..2ceb21a06962e780e76e376870f489725ebd3381:/code/main.py diff --git a/code/main.py b/code/main.py index 5874928..7531852 100755 --- a/code/main.py +++ b/code/main.py @@ -17,7 +17,7 @@ def revertStandardError(): """Move stderr to stdout, and return the contents of the old stderr.""" errio = sys.stderr if not isinstance(errio, StringIO): - return None + return '' sys.stderr = sys.stdout errio.seek(0) return errio.read() @@ -120,6 +120,9 @@ DEFAULT_HEADERS = {'Content-Type': 'text/html'} def error(op, username, fields, err, emsg): """Print an error page when a CodeError occurs""" + send_error_mail('xvm error on %s for %s: %s' % (op, username, err), + 'error on %s for %s: %s\n\n%s\n' + % (op, username, err, emsg)) d = dict(op=op, user=username, errorMessage=str(err), stderr=emsg) return templates.error(searchList=[d]) @@ -581,7 +584,7 @@ def unauthFront(_, _2, fields): def throwError(_, __, ___): """Throw an error, to test the error-tracing mechanisms.""" - raise RuntimeError("This is a test of the emergency broadcast system.") + raise CodeError("test of the emergency broadcast system") mapping = dict(list=listVms, vnc=vnc,