lib/rocket_job/sliced/slice.rb in rocketjob-4.1.1 vs lib/rocket_job/sliced/slice.rb in rocketjob-4.2.0
- old
+ new
@@ -117,9 +117,17 @@
end
self.failure_count = failure_count.to_i + 1
self.worker_name = nil
end
+ # Returns the failed record.
+ # Returns [nil] if there is no failed record
+ def failed_record
+ if exception && (record_number = exception.record_number)
+ at(record_number - 1)
+ end
+ end
+
# Returns [Hash] the slice as a Hash for storage purposes
# Compresses / Encrypts the slice according to the job setting
if ::Mongoid::VERSION.to_i >= 6
def as_attributes
attrs = super