Class: ActiveJob::Retry::ExponentialOptionsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job/retry/exponential_options_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ExponentialOptionsValidator

Returns a new instance of ExponentialOptionsValidator.



6
7
8
# File 'lib/active_job/retry/exponential_options_validator.rb', line 6

def initialize(options)
  @options = options
end

Instance Method Details

#validate!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/active_job/retry/exponential_options_validator.rb', line 10

def validate!
  validate_limit_numericality!
  validate_infinite_limit!
  validate_delay_not_specified!
  validate_not_both_exceptions!
  # Fatal exceptions must be an array (cannot be nil, since then all
  # exceptions would be fatal - for that just set `limit: 0`)
  validate_array_of_exceptions!(:fatal_exceptions)
  # Retryable exceptions must be an array of exceptions or `nil` to retry
  # any exception
  if options[:retryable_exceptions]
    validate_array_of_exceptions!(:retryable_exceptions)
  end
end