diff mercurial/hgweb/hgweb_mod.py @ 3445:233c733e4af5

httprepo: add support for passing lookup exception data
author Matt Mackall <mpm@selenic.com>
date Wed, 18 Oct 2006 02:08:36 -0500
parents 3505fcd5a231
children 0e68608bd11d
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -884,7 +884,13 @@ class hgweb(object):
         req.write(self.filelog(self.filectx(req)))
 
     def do_lookup(self, req):
-        resp = hex(self.repo.lookup(req.form['key'][0])) + "\n"
+        try:
+            r = hex(self.repo.lookup(req.form['key'][0]))
+            success = 1
+        except Exception,inst:
+            r = str(inst)
+            success = 0
+        resp = "%s %s\n" % (success, r)
         req.httphdr("application/mercurial-0.1", length=len(resp))
         req.write(resp)