Skip to content

Commit

Permalink
Add error logging for SendNotificationEmailJob
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrillberg committed Feb 28, 2025
1 parent 6e66ad8 commit 51a49d7
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def perform(notification_type:, form_submission_attempt:, form_number:, user_acc
notification_email
end
rescue => e
StatsD.increment('silent_failure', tags: statsd_tags) if notification_type == :error
raise e
handle_exception(e)
end

private
Expand Down Expand Up @@ -60,6 +59,17 @@ def time_to_send
def statsd_tags
{ 'service' => 'veteran-facing-forms', 'function' => "#{form_number} form submission to Lighthouse" }
end

def handle_exception(e)
Rails.logger.error(
'Error sending simple forms notification email',
message: e.message,
notification_type:,
confirmation_number: config[:confirmation_number]
)
StatsD.increment('silent_failure', tags: statsd_tags) if notification_type == :error
raise e
end
end
end
end

0 comments on commit 51a49d7

Please sign in to comment.