Skip logging rescuable exceptions which are defined in rescue_from/retry_on/discard_on.

Update activejob/CHANGELOG.md

Co-authored-by: Rafael França <rafael@franca.dev>
This commit is contained in:
HU Hailin 2020-12-25 02:41:54 +09:00
parent c02d9e5a3d
commit 0c6f32a9f9
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,6 @@
* Skip logging rescuable exceptions which are defined in rescue_from/retry_on/discard_on.
*Hu Hailin*
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activejob/CHANGELOG.md) for previous changes.

View File

@ -54,9 +54,11 @@ module ActiveJob
job = event.payload[:job]
ex = event.payload[:exception_object]
if ex
unless job.class.rescue_handlers.any? { |handler| handler[0] == event.payload[:exception][0] }
error do
"Error performing #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms: #{ex.class} (#{ex.message}):\n" + Array(ex.backtrace).join("\n")
end
end
elsif event.payload[:aborted]
error do
"Error performing #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms: a before_perform callback halted the job execution"