mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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:
parent
c02d9e5a3d
commit
0c6f32a9f9
2 changed files with 6 additions and 2 deletions
|
@ -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.
|
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activejob/CHANGELOG.md) for previous changes.
|
||||||
|
|
|
@ -54,9 +54,11 @@ module ActiveJob
|
||||||
job = event.payload[:job]
|
job = event.payload[:job]
|
||||||
ex = event.payload[:exception_object]
|
ex = event.payload[:exception_object]
|
||||||
if ex
|
if ex
|
||||||
|
unless job.class.rescue_handlers.any? { |handler| handler[0] == event.payload[:exception][0] }
|
||||||
error do
|
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")
|
"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
|
||||||
|
end
|
||||||
elsif event.payload[:aborted]
|
elsif event.payload[:aborted]
|
||||||
error do
|
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"
|
"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"
|
||||||
|
|
Loading…
Reference in a new issue