# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 2018-02-01 00:43:46
# Node ID e69e65b2b4a98dd206498bf34aafab8a39299fd1
# Parent  cdc93fe1da77f9063ae502b76d98d11df599d652

hgweb: move call to protocol handler outside of try..except

The protocol handler doesn't raise ErrorResponse. So it doesn't
need to be in this `try..except ErrorResponse` block.

Differential Revision: https://phab.mercurial-scm.org/D2020

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -368,7 +368,6 @@ class hgweb(object):
                     raise ErrorResponse(HTTP_NOT_FOUND)
                 if cmd in perms:
                     self.check_perm(rctx, req, perms[cmd])
-                return protohandler['dispatch']()
             except ErrorResponse as inst:
                 # A client that sends unbundle without 100-continue will
                 # break if we respond early.
@@ -383,6 +382,8 @@ class hgweb(object):
                             body='0\n%s\n' % inst)
                 return ''
 
+            return protohandler['dispatch']()
+
         # translate user-visible url structure to internal structure
 
         args = query.split('/', 2)