Index: /trunk/packages/sipb-xen-www/code/main.py
===================================================================
--- /trunk/packages/sipb-xen-www/code/main.py	(revision 598)
+++ /trunk/packages/sipb-xen-www/code/main.py	(revision 599)
@@ -18,5 +18,5 @@
     errio = sys.stderr
     if not isinstance(errio, StringIO):
-        return None
+        return ''
     sys.stderr = sys.stdout
     errio.seek(0)
@@ -121,4 +121,7 @@
 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)
@@ -582,5 +585,5 @@
 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,
Index: /trunk/packages/sipb-xen-www/code/templates/error.tmpl
===================================================================
--- /trunk/packages/sipb-xen-www/code/templates/error.tmpl	(revision 598)
+++ /trunk/packages/sipb-xen-www/code/templates/error.tmpl	(revision 599)
@@ -7,6 +7,16 @@
 
 #def body
-<p>$errorMessage in operation $op.  This shouldn't happen!  Please
-email xvm@mit.edu to explain how it happened.  Stderr:</p>
-<pre>$stderr</pre>
+<p>Uh-oh!  We experienced an error.  Sorry about that.  We've gotten
+mail about it.</p>
+
+<p>Feel free to poke us at <tt>xvm@mit.edu</tt> if this bug is
+consistently biting you and we don't seem to be fixing it.</p>
+
+<p>In case you're curious, the gory details are here.</p>
+
+<pre>
+Error on operation $op for user $user: $errorMessage
+Error output (if any):
+$stderr
+</pre>
 #end def
