From d327c213ff6c976154f5a58c9fb789b41f30169b Mon Sep 17 00:00:00 2001 From: Richard Lynch Date: Fri, 27 Dec 2024 11:27:33 +0000 Subject: [PATCH] Include claim reference in rollbar errors When a job errors we want to be able to easily identify which claim it was working with, if there is one. --- app/jobs/application_job.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 72b7921270..0ed81d840a 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,4 +1,14 @@ class ApplicationJob < ActiveJob::Base + around_perform do |job, block| + claim = job.arguments.find { |arg| arg.is_a?(Claim) } + + if claim + Rollbar.scope!(claim: {reference: claim.reference}) + end + + block.call + end + def priority 10 end