Skip to content

A platform for community discussion. Free, open, simple.

DEV: Improve logging of errors in `Jobs::ProcessUserNotificationSchedules`

Alan Guo Xiang Tan0d8144b62b7b
diff --git a/app/jobs/scheduled/process_user_notification_schedules.rb b/app/jobs/scheduled/process_user_notification_schedules.rb
index a82db6e2d59..1e793e01f06 100644
--- a/app/jobs/scheduled/process_user_notification_schedules.rb
+++ b/app/jobs/scheduled/process_user_notification_schedules.rb
@@ -8,8 +8,8 @@ module Jobs
UserNotificationSchedule.enabled.includes(:user).each do |schedule|
begin
schedule.create_do_not_disturb_timings
- rescue
- Rails.logger.warn("Failed to process user_notification_schedule with ID #{schedule.id}")
+ rescue => e
+ Discourse.warn_exception(e, message: "Failed to process user_notification_schedule with ID #{schedule.id}")
end
end
end