diff --git a/lib/gitlab/email/handler/base_handler.rb b/lib/gitlab/email/handler/base_handler.rb index 230d13feea9..dcbad5bdb29 100644 --- a/lib/gitlab/email/handler/base_handler.rb +++ b/lib/gitlab/email/handler/base_handler.rb @@ -42,7 +42,7 @@ module Gitlab end.join end - def verify_record(record, exception, error_title) + def verify_record!(record, exception, error_title) return if record.persisted? msg = error_title + record.errors.full_messages.map do |error| diff --git a/lib/gitlab/email/handler/create_issue_handler.rb b/lib/gitlab/email/handler/create_issue_handler.rb index 259d74a83bf..cba8f2b61f6 100644 --- a/lib/gitlab/email/handler/create_issue_handler.rb +++ b/lib/gitlab/email/handler/create_issue_handler.rb @@ -12,7 +12,7 @@ module Gitlab def execute validate_permission!(:create_issue) - verify_record( + verify_record!( create_issue, InvalidIssueError, "The issue could not be created for the following reasons:" diff --git a/lib/gitlab/email/handler/create_note_handler.rb b/lib/gitlab/email/handler/create_note_handler.rb index 7252906fd48..282f1844097 100644 --- a/lib/gitlab/email/handler/create_note_handler.rb +++ b/lib/gitlab/email/handler/create_note_handler.rb @@ -18,7 +18,7 @@ module Gitlab raise NoteableNotFoundError unless sent_notification.noteable raise EmptyEmailError if message.blank? - verify_record( + verify_record!( create_note, InvalidNoteError, "The comment could not be created for the following reasons:"