Commit c64cd113 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add ! for verify_record! because it could raise

parent 75415663
...@@ -42,7 +42,7 @@ module Gitlab ...@@ -42,7 +42,7 @@ module Gitlab
end.join end.join
end end
def verify_record(record, exception, error_title) def verify_record!(record, exception, error_title)
return if record.persisted? return if record.persisted?
msg = error_title + record.errors.full_messages.map do |error| msg = error_title + record.errors.full_messages.map do |error|
......
...@@ -12,7 +12,7 @@ module Gitlab ...@@ -12,7 +12,7 @@ module Gitlab
def execute def execute
validate_permission!(:create_issue) validate_permission!(:create_issue)
verify_record( verify_record!(
create_issue, create_issue,
InvalidIssueError, InvalidIssueError,
"The issue could not be created for the following reasons:" "The issue could not be created for the following reasons:"
......
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
raise NoteableNotFoundError unless sent_notification.noteable raise NoteableNotFoundError unless sent_notification.noteable
raise EmptyEmailError if message.blank? raise EmptyEmailError if message.blank?
verify_record( verify_record!(
create_note, create_note,
InvalidNoteError, InvalidNoteError,
"The comment could not be created for the following reasons:" "The comment could not be created for the following reasons:"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment