Exception: Amigo::Retry::OrDie

Inherits:
Error
  • Object
show all
Defined in:
lib/amigo/retry.rb

Overview

Raise this class, or a subclass of it, to:

  • Use Retry exception semantics while the current attempt is <= attempts, or

  • Use Die exception semantics if the current attempt is > attempts.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attempts, interval_or_timestamp, msg = nil) ⇒ OrDie

Returns a new instance of OrDie.



65
66
67
68
69
70
# File 'lib/amigo/retry.rb', line 65

def initialize(attempts, interval_or_timestamp, msg=nil)
  @wrapped = exc?(msg)
  @attempts = attempts
  @interval_or_timestamp = interval_or_timestamp
  super(exc_or_msg("retry every #{interval_or_timestamp.to_i}s up to #{attempts} times", msg))
end

Instance Attribute Details

#attemptsObject (readonly)

Returns the value of attribute attempts.



63
64
65
# File 'lib/amigo/retry.rb', line 63

def attempts
  @attempts
end

#interval_or_timestampObject (readonly)

Returns the value of attribute interval_or_timestamp.



63
64
65
# File 'lib/amigo/retry.rb', line 63

def interval_or_timestamp
  @interval_or_timestamp
end

#wrappedObject (readonly)

Returns the value of attribute wrapped.



63
64
65
# File 'lib/amigo/retry.rb', line 63

def wrapped
  @wrapped
end