[PATCH 1 of 3 RFC STABLE] serve: log exceptions in error log

Mads Kiilerich mads at kiilerich.com
Fri Feb 18 20:18:32 CST 2011


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1298081619 -3600
# Branch stable
# Node ID ff833ea575ee79d91cfa9cfe7e04d8937cff9d30
# Parent  b366a5e021c6d8d1e3774d7829af2c0c74d2163c
serve: log exceptions in error log

The default error handler just printed exceptions but they did not appear when
running in daemon mode.

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -74,6 +74,10 @@
             tb = "".join(traceback.format_exception(*sys.exc_info()))
             self.log_error("Exception happened during processing "
                            "request '%s':\n%s", self.path, tb)
+        except Exception:
+            tb = "".join(traceback.format_exception(*sys.exc_info()))
+            self.log_error("Unhandled exception processing "
+                           "request '%s':\n%s", self.path, tb)
 
     def do_GET(self):
         self.do_POST()


More information about the Mercurial-devel mailing list