From b6353eb61087a58e29acfa1e7c87ab887d9bd598 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro Vassallo Date: Wed, 18 Oct 2023 16:00:33 -0300 Subject: [PATCH 1/3] Added job raw_error accessor --- lib/little_monster/core/job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/little_monster/core/job.rb b/lib/little_monster/core/job.rb index a6994cc..b01957f 100644 --- a/lib/little_monster/core/job.rb +++ b/lib/little_monster/core/job.rb @@ -92,7 +92,7 @@ def mock? end end - attr_accessor :id, :tags, :status, :retries, :current_action, :data, :error + attr_accessor :id, :tags, :status, :retries, :current_action, :data, :error, :raw_error attr_reader :orchrestator From c4cd886d72d08f971a51b0600c4ec51e62ba47b9 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro Vassallo Date: Wed, 18 Oct 2023 16:02:00 -0300 Subject: [PATCH 2/3] Added job raw_error set --- lib/little_monster/core/job_orchrestator.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/little_monster/core/job_orchrestator.rb b/lib/little_monster/core/job_orchrestator.rb index 977c3f0..17cae76 100644 --- a/lib/little_monster/core/job_orchrestator.rb +++ b/lib/little_monster/core/job_orchrestator.rb @@ -182,6 +182,7 @@ def handle_error(error) end @job.error = @job.serialize_error error + @job.raw_error = error if error.is_a?(FatalTaskError) || error.is_a?(NameError) logger.debug 'error is fatal, aborting run' From ea5803f152ec5627f7abaa096b4e2e402f59438d Mon Sep 17 00:00:00 2001 From: Manuel Alejandro Vassallo Date: Mon, 30 Oct 2023 15:08:08 -0300 Subject: [PATCH 3/3] Test --- spec/lib/little_monster/core/job_orchrestator_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/lib/little_monster/core/job_orchrestator_spec.rb b/spec/lib/little_monster/core/job_orchrestator_spec.rb index 450de61..1275d16 100644 --- a/spec/lib/little_monster/core/job_orchrestator_spec.rb +++ b/spec/lib/little_monster/core/job_orchrestator_spec.rb @@ -626,6 +626,13 @@ subject.handle_error error expect(subject).to have_received(:do_retry).with error end + + it 'sets error and raw_error' do + error = LittleMonster::TaskError.new + subject.handle_error error + expect(subject.job.error).to eq(message: error.message, type: error.class.to_s, retry: subject.job.retries) + expect(subject.job.raw_error).to eq(error) + end end end