diff mercurial/hgweb/webcommands.py @ 6368:2c370f08c486

hgweb: better error messages
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Sun, 23 Mar 2008 23:08:18 +0100
parents fe8dbbe9520d
children 2540521dc7c1 782dbbdfb1d7
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sun Mar 23 22:15:47 2008 +0100
+++ b/mercurial/hgweb/webcommands.py	Sun Mar 23 23:08:18 2008 +0100
@@ -34,10 +34,13 @@
 
     try:
         fctx = web.filectx(req)
-    except revlog.LookupError:
-        content = web.manifest(tmpl, web.changectx(req), path)
-        req.respond(HTTP_OK, web.ctype)
-        return content
+    except revlog.LookupError, inst:
+        try:
+            content = web.manifest(tmpl, web.changectx(req), path)
+            req.respond(HTTP_OK, web.ctype)
+            return content
+        except ErrorResponse:
+            raise inst
 
     path = fctx.path()
     text = fctx.data()
@@ -53,10 +56,13 @@
     if path:
         try:
             return web.filerevision(tmpl, web.filectx(req))
-        except revlog.LookupError:
+        except revlog.LookupError, inst:
             pass
 
-    return web.manifest(tmpl, web.changectx(req), path)
+    try:
+        return web.manifest(tmpl, web.changectx(req), path)
+    except ErrorResponse:
+        raise inst
 
 def changelog(web, req, tmpl, shortlog = False):
     if 'node' in req.form:
@@ -109,7 +115,7 @@
         web.configbool("web", "allow" + type_, False))):
         web.archive(tmpl, req, req.form['node'][0], type_)
         return []
-    raise ErrorResponse(HTTP_NOT_FOUND, 'Unsupported archive type: %s' % type_)
+    raise ErrorResponse(HTTP_NOT_FOUND, 'unsupported archive type: %s' % type_)
 
 def static(web, req, tmpl):
     fname = req.form['file'][0]