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

Gives us the actual error and backtrace to work with. Otherwise, the
logging of the error is not useful at all.
This commit is contained in:
Alan Guo Xiang Tan 2021-07-21 12:18:34 +08:00
parent 4223541bc5
commit 0d8144b62b
1 changed files with 2 additions and 2 deletions

View File

@ -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