diff options
Diffstat (limited to 'app/services/projects/transfer_service.rb')
-rw-r--r-- | app/services/projects/transfer_service.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index da6e6acd4a7..1c24b27a870 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -12,12 +12,13 @@ module Projects TransferError = Class.new(StandardError) def execute(new_namespace) - if allowed_transfer?(current_user, project, new_namespace) - transfer(project, new_namespace) - else - project.errors.add(:new_namespace, 'is invalid') - false + if new_namespace.blank? + raise TransferError, 'Please select a new namespace for your project.' end + unless allowed_transfer?(current_user, project, new_namespace) + raise TransferError, 'Transfer failed, please contact an admin.' + end + transfer(project, new_namespace) rescue Projects::TransferService::TransferError => ex project.reload project.errors.add(:new_namespace, ex.message) |