hgweb: give ErrorResponse a descriptive string/Exception representation
Very handy if the exception should appear in output.
--- 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