Moved cleanup before raising (the code couldn't be reached before)
This commit is contained in:
parent
400aa5fe51
commit
9cf650d2ab
1 changed files with 3 additions and 3 deletions
|
@ -1138,9 +1138,6 @@ def create_repo(root, namespace=None):
|
|||
config.write(" namespace: '%s'\n" % namespace)
|
||||
|
||||
except (IOError, OSError) as e:
|
||||
raise BadRepoError('Failed to create new repository in %s.' % root,
|
||||
"Caused by %s: %s" % (type(e), e))
|
||||
|
||||
# try to clean up.
|
||||
if existed:
|
||||
shutil.rmtree(config_path, ignore_errors=True)
|
||||
|
@ -1148,6 +1145,9 @@ def create_repo(root, namespace=None):
|
|||
else:
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
|
||||
raise BadRepoError('Failed to create new repository in %s.' % root,
|
||||
"Caused by %s: %s" % (type(e), e))
|
||||
|
||||
return full_path, namespace
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue