hgweb: trap lookup errors
authorBrendan Cully <brendan@kublai.com>
Wed, 11 Oct 2006 16:56:41 -0700
changeset 3359 41741218504d
parent 3358 818598f5bc8b
child 3360 ef8307585b41
hgweb: trap lookup errors
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Wed Oct 11 16:50:17 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Oct 11 16:56:41 2006 -0700
@@ -13,7 +13,7 @@
 demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile")
 demandload(globals(), 'urllib')
 demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone,patch")
-demandload(globals(), "mercurial:templater")
+demandload(globals(), "mercurial:revlog,templater")
 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map")
 from mercurial.node import *
 from mercurial.i18n import gettext as _
@@ -765,7 +765,10 @@
 
         method = getattr(self, 'do_' + cmd, None)
         if method:
-            method(req)
+            try:
+                method(req)
+            except (hg.RepoError, revlog.RevlogError), inst:
+                req.write(self.t("error", error=str(inst)))
         else:
             req.write(self.t("error", error='No such method: ' + cmd))