diff options
Diffstat (limited to 'lib/gitlab/email/receiver.rb')
-rw-r--r-- | lib/gitlab/email/receiver.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/email/receiver.rb b/lib/gitlab/email/receiver.rb index ba84be6e8ca..1e03f5d17ee 100644 --- a/lib/gitlab/email/receiver.rb +++ b/lib/gitlab/email/receiver.rb @@ -10,6 +10,14 @@ module Gitlab RECEIVED_HEADER_REGEX = /for\s+\<(.+)\>/.freeze + # Errors that are purely from users and not anything we can control + USER_ERRORS = [ + Gitlab::Email::AutoGeneratedEmailError, Gitlab::Email::ProjectNotFound, Gitlab::Email::EmptyEmailError, + Gitlab::Email::UserNotFoundError, Gitlab::Email::UserBlockedError, Gitlab::Email::UserNotAuthorizedError, + Gitlab::Email::NoteableNotFoundError, Gitlab::Email::InvalidAttachment, Gitlab::Email::InvalidRecordError, + Gitlab::Email::EmailTooLarge + ].freeze + def initialize(raw) @raw = raw end @@ -24,6 +32,9 @@ module Gitlab handler.execute.tap do Gitlab::Metrics::BackgroundTransaction.current&.add_event(handler.metrics_event, handler.metrics_params) end + rescue *USER_ERRORS => e + # do not send a metric event since these are purely user errors that we can't control + raise e rescue StandardError => e Gitlab::Metrics::BackgroundTransaction.current&.add_event('email_receiver_error', error: e.class.name) raise e |