# HG changeset patch # User Marcin Kuzminski # Date 2020-06-10 13:11:13 # Node ID 67405995914a3f5e72c89ce115dcc0825c74804e # Parent 1d5adfe8ab3aac5c4b3ac4fcbb9e793c3cc888c4 init: better error reporting on failed components diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -58,23 +58,30 @@ from vcsserver.exceptions import HTTPRep from vcsserver.lib.exc_tracking import store_exception from vcsserver.server import VcsServer + +git_import_err = None try: from vcsserver.git import GitFactory, GitRemote -except ImportError: +except ImportError as e: GitFactory = None GitRemote = None + git_import_err = e +hg_import_err = None try: from vcsserver.hg import MercurialFactory, HgRemote -except ImportError: +except ImportError as e: MercurialFactory = None HgRemote = None + hg_import_err = e +svn_import_err = None try: from vcsserver.svn import SubversionFactory, SvnRemote -except ImportError: +except ImportError as e: SubversionFactory = None SvnRemote = None + svn_import_err = e def _is_request_chunked(environ): @@ -126,13 +133,13 @@ class VCS(object): git_factory = GitFactory() self._git_remote = GitRemote(git_factory) else: - log.info("Git client import failed") + log.error("Git client import failed: %s", git_import_err) if MercurialFactory and HgRemote: hg_factory = MercurialFactory() self._hg_remote = HgRemote(hg_factory) else: - log.info("Mercurial client import failed") + log.error("Mercurial client import failed: %s", hg_import_err) if SubversionFactory and SvnRemote: svn_factory = SubversionFactory() @@ -141,7 +148,7 @@ class VCS(object): hg_factory = MercurialFactory() self._svn_remote = SvnRemote(svn_factory, hg_factory=hg_factory) else: - log.info("Subversion client import failed") + log.error("Subversion client import failed: %s", svn_import_err) self._vcsserver = VcsServer() @@ -149,8 +156,7 @@ class VCS(object): if self.locale: log.info('Settings locale: `LC_ALL` to %s', self.locale) else: - log.info( - 'Configuring locale subsystem based on environment variables') + log.info('Configuring locale subsystem based on environment variables') try: # If self.locale is the empty string, then the locale # module will use the environment variables. See the @@ -162,8 +168,7 @@ class VCS(object): 'Locale set to language code "%s" with encoding "%s".', language_code, encoding) except locale.Error: - log.exception( - 'Cannot set locale, not configuring the locale system') + log.exception('Cannot set locale, not configuring the locale system') class WsgiProxy(object):