##// END OF EJS Templates
exception-handling: nicer error catching on repository creation.
marcink -
r1187:c2d0103a default
parent child Browse files
Show More
@@ -159,8 +159,7 b' def create_repo(form_data, cur_user):'
159 state=state
159 state=state
160 )
160 )
161
161
162 action_logger(cur_user, 'user_created_repo',
162 action_logger(cur_user, 'user_created_repo', repo_name_full, '', DBS)
163 repo_name_full, '', DBS)
164 DBS.commit()
163 DBS.commit()
165
164
166 # now create this repo on Filesystem
165 # now create this repo on Filesystem
@@ -179,9 +178,9 b' def create_repo(form_data, cur_user):'
179 # set new created state
178 # set new created state
180 repo.set_state(Repository.STATE_CREATED)
179 repo.set_state(Repository.STATE_CREATED)
181 DBS.commit()
180 DBS.commit()
182 except Exception as e:
181 except Exception:
183 log.warning('Exception %s occurred when creating repository, '
182 log.warning('Exception occurred when creating repository, '
184 'doing cleanup...', e)
183 'doing cleanup...', exc_info=True)
185 # rollback things manually !
184 # rollback things manually !
186 repo = Repository.get_by_repo_name(repo_name_full)
185 repo = Repository.get_by_repo_name(repo_name_full)
187 if repo:
186 if repo:
@@ -264,7 +264,8 b' class SettingsModel(BaseModel):'
264 repo = self._get_repo(self.repo)
264 repo = self._get_repo(self.repo)
265 if not repo:
265 if not repo:
266 raise Exception(
266 raise Exception(
267 'Repository {} cannot be found'.format(self.repo))
267 'Repository `{}` cannot be found inside the database'.format(
268 self.repo))
268 return repo
269 return repo
269
270
270 def _filter_by_repo(self, model, query):
271 def _filter_by_repo(self, model, query):
General Comments 0
You need to be logged in to leave comments. Login now