hgweb: give ErrorResponse a descriptive string/Exception representation stable
authorMads Kiilerich <mads@kiilerich.com>
Mon, 21 Feb 2011 00:52:26 +0100
branchstable
changeset 13444 75f5f312df5f
parent 13443 8fa83d7159eb
child 13445 61a898576888
hgweb: give ErrorResponse a descriptive string/Exception representation Very handy if the exception should appear in output.
mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py	Mon Feb 21 00:52:23 2011 +0100
+++ b/mercurial/hgweb/common.py	Mon Feb 21 00:52:26 2011 +0100
@@ -71,13 +71,12 @@
 
 class ErrorResponse(Exception):
     def __init__(self, code, message=None, headers=[]):
-        Exception.__init__(self)
+        if message is None:
+            message = _statusmessage(code)
+        Exception.__init__(self, code, message)
         self.code = code
+        self.message = message
         self.headers = headers
-        if message is not None:
-            self.message = message
-        else:
-            self.message = _statusmessage(code)
 
 def _statusmessage(code):
     from BaseHTTPServer import BaseHTTPRequestHandler