cron: fix undefined variable in exception handler (again)

Fixup for a1d4408c2.
This commit is contained in:
evazion
2021-09-29 06:04:28 -05:00
parent 2eb89a8354
commit 627e8e1013
2 changed files with 11 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ module DanbooruMaintenance
ApplicationRecord.connection.verify!
job.perform_later
rescue Exception => e # rubocop:disable Lint/RescueException
DanbooruLogger.log(exception)
DanbooruLogger.log(e)
raise e if Rails.env.test?
end
end

View File

@@ -8,6 +8,16 @@ class DanbooruMaintenanceTest < ActiveSupport::TestCase
perform_enqueued_jobs
end
end
should "log errors" do
assert_raise(RuntimeError) do
PrunePostsJob.stubs(:perform_later).raises(RuntimeError)
DanbooruLogger.expects(:log)
DanbooruMaintenance.hourly
perform_enqueued_jobs
end
end
end
context "daily maintenance" do