# HG changeset patch # User Thomas Arendsen Hein # Date 1132252737 -3600 # Node ID 68ec7b9e09a48d8100cf5394279060cefdda1f82 # Parent 4aeba581990bf84dd5287c62a959e7b5657535e1 Catch IOErrors and RepoErrors when serving repositories via hgweb. diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -1013,7 +1013,12 @@ class hgwebdir: if virtual: real = dict(self.repos).get(virtual) if real: - hgweb(real).run(req) + try: + hgweb(real).run(req) + except IOError, inst: + req.write(tmpl("error", error=inst.strerror)) + except hg.RepoError, inst: + req.write(tmpl("error", error=str(inst))) else: req.write(tmpl("notfound", repo=virtual)) else: diff --git a/templates/error.tmpl b/templates/error.tmpl new file mode 100644 --- /dev/null +++ b/templates/error.tmpl @@ -0,0 +1,15 @@ +#header# +Mercurial Error + + + +

Mercurial Error

+ +

+An error occured while processing your request: +

+

+#error|escape# +

+ +#footer# diff --git a/templates/map b/templates/map --- a/templates/map +++ b/templates/map @@ -39,3 +39,4 @@ indexentry = "#type# " notfound = notfound.tmpl +error = error.tmpl