From 1cf9b07864f9bfe63e454d17238e96e33927d201 Mon Sep 17 00:00:00 2001 From: Dustin Pearson <30442914+Wittiest@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:50:57 -0700 Subject: [PATCH] Deprecate GoodJob::Job#recent_error (#1526) * Deprecate GoodJob::Job#recent_error * Fix linter --- app/models/good_job/job.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/good_job/job.rb b/app/models/good_job/job.rb index 063d1f5c..42e9b0be 100644 --- a/app/models/good_job/job.rb +++ b/app/models/good_job/job.rb @@ -390,7 +390,12 @@ def self.format_error(error) # If the job has been retried, the error will be fetched from the previous {Execution} record. # @return [String] def recent_error - error || executions[-2]&.error + GoodJob.deprecator.warn(<<~DEPRECATION) + The `GoodJob::Job#recent_error` method is deprecated and will be removed in the next major release. + + Replace usage of GoodJob::Job#recent_error with `GoodJob::Job#error`. + DEPRECATION + error end # Errors for the job to be displayed in the Dashboard.