Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error logging for SendNotificationEmailJob #21028

Merged
merged 8 commits into from
Mar 5, 2025
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,16 @@ 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to confirm there's no possibility for PII / sensitive information being leaked in this log.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope this should be good for PII. The error message would not include PII unless it somehow accesses the form data from inside the form submission on its own.

notification_type:,
confirmation_number: config[:confirmation_number]
)
StatsD.increment('silent_failure', tags: statsd_tags) if notification_type == :error
end
end
end
end
Loading