changeset 13444:75f5f312df5f stable

hgweb: give ErrorResponse a descriptive string/Exception representation Very handy if the exception should appear in output.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 21 Feb 2011 00:52:26 +0100
parents 8fa83d7159eb
children 61a898576888
files mercurial/hgweb/common.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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