Exception: MailCapture::TimeoutError
- Defined in:
- lib/mailcapture/errors.rb
Overview
Raised by wait_for when no email arrives before the timeout.
rescue MailCapture::TimeoutError => e
puts "Waited #{e.waited_seconds}s for tag: #{e.tag}"
end
Instance Attribute Summary collapse
-
#tag ⇒ String
readonly
The tag that was being waited on.
-
#waited_seconds ⇒ Numeric
readonly
Seconds elapsed before giving up.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(tag:, waited_seconds:, hint: nil) ⇒ TimeoutError
constructor
A new instance of TimeoutError.
Constructor Details
#initialize(tag:, waited_seconds:, hint: nil) ⇒ TimeoutError
Returns a new instance of TimeoutError.
42 43 44 45 46 47 48 |
# File 'lib/mailcapture/errors.rb', line 42 def initialize(tag:, waited_seconds:, hint: nil) @tag = tag @waited_seconds = waited_seconds = "No email arrived for tag #{tag.inspect} within #{waited_seconds.to_i}s." += " #{hint}" if hint super(, code: 'TIMEOUT') end |
Instance Attribute Details
#tag ⇒ String (readonly)
Returns the tag that was being waited on.
38 39 40 |
# File 'lib/mailcapture/errors.rb', line 38 def tag @tag end |
#waited_seconds ⇒ Numeric (readonly)
Returns seconds elapsed before giving up.
40 41 42 |
# File 'lib/mailcapture/errors.rb', line 40 def waited_seconds @waited_seconds end |