--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -11,7 +11,7 @@
# Non-stdlib imports
import pkg_resources
-from tg import expose, validate, redirect, response, url
+from tg import expose, validate, redirect, response, url, flash
from tg.decorators import with_trailing_slash, without_trailing_slash
import pylons
from pylons import g, c, request
@@ -187,11 +187,15 @@
in_use=in_use,
to_name=to_name or '')
else:
- to_project.install_app(
- 'Git', to_name,
- cloned_from_project_id=from_project._id,
- cloned_from_repo_id=from_repo._id)
- redirect('/'+to_project_name+'/'+to_name+'/')
+ try:
+ to_project.install_app(
+ 'Git', to_name,
+ cloned_from_project_id=from_project._id,
+ cloned_from_repo_id=from_repo._id)
+ redirect('/'+to_project_name+'/'+to_name+'/')
+ except Exception, ex:
+ flash(str(ex), 'error')
+ redirect(request.referer)
class Refs(object):