Skip to content

Commit

Permalink
Improved Error Handling for VAForms::FormReloader Job (#12370)
Browse files Browse the repository at this point in the history
* Add specific error handling around method currently failing silently in EKS Sidekiq env
  • Loading branch information
kristen-brown authored Apr 10, 2023
1 parent 3cdea8c commit ff7ebe5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/va_forms/app/workers/va_forms/form_reloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ def update_sha256(form)
form.valid_pdf = false
end
form
rescue
rescue => e
message = "#{self.class.name} failed to get SHA-256 hash from form"
form_data = { form_name: form.form_name, form_url: form.url }.to_s

Rails.logger.error("#{message}: #{form_data}", e)
VAForms::Slack::Messenger.new({ class: self.class.name, message:, exception: e, form_data: }).notify!

form.valid_pdf = false
form
end
Expand Down
4 changes: 4 additions & 0 deletions modules/va_forms/spec/workers/form_reloader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
subject { described_class }

let(:form_reloader) { VAForms::FormReloader.new }
let(:slack_messenger) { instance_double(VAForms::Slack::Messenger) }

before do
Sidekiq::Worker.clear_all

allow(VAForms::Slack::Messenger).to receive(:new).and_return(slack_messenger)
allow(slack_messenger).to receive(:notify!)
end

describe 'importer' do
Expand Down

0 comments on commit ff7ebe5

Please sign in to comment.