diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2016-02-16 00:20:18 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-02-19 21:14:54 +0300 |
commit | 169070ba4b83b1cbb4084abcf8ffeb9f492fcffa (patch) | |
tree | d8491d0a1058b8f2b2d66ee81388417566560e29 /app/services/commits/revert_service.rb | |
parent | 6908663479b267cd82402439a3e5059a1477b4d9 (diff) |
Some updates from last code review.
Diffstat (limited to 'app/services/commits/revert_service.rb')
-rw-r--r-- | app/services/commits/revert_service.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/app/services/commits/revert_service.rb b/app/services/commits/revert_service.rb index f4c6c55f615..43d1c766e35 100644 --- a/app/services/commits/revert_service.rb +++ b/app/services/commits/revert_service.rb @@ -28,7 +28,7 @@ module Commits unless repository.revert(current_user, @commit, revert_into) error_msg = "Sorry, we cannot revert this #{params[:revert_type_title]} automatically. It may have already been reverted, or a more recent commit may have updated some of its content." - raise_error(ReversionError, error_msg) + raise ReversionError, error_msg end success @@ -41,19 +41,15 @@ module Commits .execute(@commit.revert_branch_name, @target_branch, source_project: @source_project) if result[:status] == :error - raise_error(ReversionError, "There was an error creating the source branch: #{result[:message]}") + raise ReversionError, "There was an error creating the source branch: #{result[:message]}" end end - def raise_error(klass, message) - raise klass.new(message) - end - def validate allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(@target_branch) unless allowed - raise_error(ValidationError, "You are not allowed to push into this branch") + raise_error('You are not allowed to push into this branch') end true |