mirror of https://github.com/rails/rails
Test exception message to ensure an exception instance is yielded
This commit is contained in:
parent
4a13c1e1d2
commit
34d7b05d27
|
@ -61,7 +61,7 @@ class ExceptionsTest < ActiveJob::TestCase
|
|||
test "custom handling of job that exceeds retry attempts" do
|
||||
perform_enqueued_jobs do
|
||||
RetryJob.perform_later "CustomCatchError", 6
|
||||
assert_equal "Dealt with a job that failed to retry in a custom way after 6 attempts", JobBuffer.last_value
|
||||
assert_equal "Dealt with a job that failed to retry in a custom way after 6 attempts. Message: CustomCatchError", JobBuffer.last_value
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class RetryJob < ActiveJob::Base
|
|||
retry_on ShortWaitTenAttemptsError, wait: 1.second, attempts: 10
|
||||
retry_on ExponentialWaitTenAttemptsError, wait: :exponentially_longer, attempts: 10
|
||||
retry_on CustomWaitTenAttemptsError, wait: ->(executions) { executions * 2 }, attempts: 10
|
||||
retry_on(CustomCatchError) { |job, exception| JobBuffer.add("Dealt with a job that failed to retry in a custom way after #{job.arguments.second} attempts") }
|
||||
retry_on(CustomCatchError) { |job, exception| JobBuffer.add("Dealt with a job that failed to retry in a custom way after #{job.arguments.second} attempts. Message: #{exception.message}") }
|
||||
discard_on DiscardableError
|
||||
|
||||
def perform(raising, attempts)
|
||||
|
|
Loading…
Reference in New Issue