diff --git a/kallithea/lib/base.py b/kallithea/lib/base.py --- a/kallithea/lib/base.py +++ b/kallithea/lib/base.py @@ -308,6 +308,8 @@ class BaseVCSController(object): if parsed_request is None: return self.application(environ, start_response) return self._handle_request(parsed_request, environ, start_response) + except webob.exc.HTTPException as e: + return e(environ, start_response) finally: log = logging.getLogger('kallithea.' + self.__class__.__name__) log.debug('Request time: %.3fs', time.time() - start) diff --git a/kallithea/lib/middleware/simplegit.py b/kallithea/lib/middleware/simplegit.py --- a/kallithea/lib/middleware/simplegit.py +++ b/kallithea/lib/middleware/simplegit.py @@ -71,7 +71,7 @@ class SimpleGit(BaseVCSController): # quick check if repo exists... if not is_valid_repo(parsed_request.repo_name, self.basepath, 'git'): - return HTTPNotFound()(environ, start_response) + raise HTTPNotFound() #====================================================================== # GET ACTION PULL or PUSH @@ -114,7 +114,7 @@ class SimpleGit(BaseVCSController): return app(environ, start_response) except Exception: log.error(traceback.format_exc()) - return HTTPInternalServerError()(environ, start_response) + raise HTTPInternalServerError() def __make_app(self, repo_name): """ diff --git a/kallithea/lib/middleware/simplehg.py b/kallithea/lib/middleware/simplehg.py --- a/kallithea/lib/middleware/simplehg.py +++ b/kallithea/lib/middleware/simplehg.py @@ -86,15 +86,12 @@ class SimpleHg(BaseVCSController): # quick check if repo exists... if not is_valid_repo(parsed_request.repo_name, self.basepath, 'hg'): - return HTTPNotFound()(environ, start_response) + raise HTTPNotFound() #====================================================================== # GET ACTION PULL or PUSH #====================================================================== - try: - action = self.__get_action(environ) - except HTTPBadRequest as e: - return e(environ, start_response) + action = self.__get_action(environ) #====================================================================== # CHECK PERMISSIONS @@ -135,7 +132,7 @@ class SimpleHg(BaseVCSController): return app(environ, start_response) except Exception: log.error(traceback.format_exc()) - return HTTPInternalServerError()(environ, start_response) + raise HTTPInternalServerError() def __make_app(self, repo_name, baseui): """