1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# frozen_string_literal: true
module Aws
module Waiters
module Errors
# Raised when a waiter detects a condition where the waiter can never
# succeed.
class WaiterFailed < StandardError; end
class FailureStateError < WaiterFailed
MSG = "stopped waiting, encountered a failure state"
def initialize(response)
@response = response
super(MSG)
end
# @return [Seahorse::Client::Response] The response that matched
# the failure state.
attr_reader :response
end
class TooManyAttemptsError < WaiterFailed
MSG = "stopped waiting after %d attempts without success"
def initialize(attempts)
@attempts = attempts
super(MSG % [attempts])
end
# @return [Integer]
attr_reader :attempts
end
class UnexpectedError < WaiterFailed
MSG = "stopped waiting due to an unexpected error: %s"
def initialize(error)
@error = error
super(MSG % [error.message])
end
# @return [Exception] The unexpected error.
attr_reader :error
end
# Raised when attempting to get a waiter by name and the waiter has not
# been defined.
class NoSuchWaiterError < ArgumentError
MSG = "no such waiter %s; valid waiter names are: %s"
def initialize(waiter_name, waiter_names)
waiter_names = waiter_names.map(&:inspect).join(', ')
super(MSG % [waiter_name.inspect, waiter_names])
end
end
end
end
end
|