# HG changeset patch # User Marcin Kuzminski # Date 2016-12-05 07:51:52 # Node ID c2d0103aca13895d2d6257c8cc2a36cba1ed20d9 # Parent 3b7f26f86990383eeb0f0035cf66e9d4a19c7e19 exception-handling: nicer error catching on repository creation. diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -159,8 +159,7 @@ def create_repo(form_data, cur_user): state=state ) - action_logger(cur_user, 'user_created_repo', - repo_name_full, '', DBS) + action_logger(cur_user, 'user_created_repo', repo_name_full, '', DBS) DBS.commit() # now create this repo on Filesystem @@ -179,9 +178,9 @@ def create_repo(form_data, cur_user): # set new created state repo.set_state(Repository.STATE_CREATED) DBS.commit() - except Exception as e: - log.warning('Exception %s occurred when creating repository, ' - 'doing cleanup...', e) + except Exception: + log.warning('Exception occurred when creating repository, ' + 'doing cleanup...', exc_info=True) # rollback things manually ! repo = Repository.get_by_repo_name(repo_name_full) if repo: diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -264,7 +264,8 @@ class SettingsModel(BaseModel): repo = self._get_repo(self.repo) if not repo: raise Exception( - 'Repository {} cannot be found'.format(self.repo)) + 'Repository `{}` cannot be found inside the database'.format( + self.repo)) return repo def _filter_by_repo(self, model, query):