module MyApiClient::Exceptions
Description of Exceptions
Attributes
args[R]
method_name[R]
retry_count[R]
retry_result[R]
Public Instance Methods
call(*args)
click to toggle source
Description of call
@param args [Array<Object>] describe_args_here @return [Object] description_of_returned_object
# File lib/my_api_client/exceptions.rb, line 13 def call(*args) @args = args send(*args) rescue StandardError => e @retry_count ||= 0 raise unless rescue_with_handler(e) retry_result end
Private Instance Methods
discard_on(*exception) { |self, error| ... }
click to toggle source
Description of discard_on
@note
!! It is implemented following ActiveJob, but I think this method is not useful in this gem. !!
@param exception [Type] describe_exception_here
# File lib/my_api_client/exceptions.rb, line 46 def discard_on(*exception) rescue_from(*exception) do |error| yield self, error if block_given? end end
retry_calling(wait)
click to toggle source
# File lib/my_api_client/exceptions.rb, line 53 def retry_calling(wait) Sleeper.call(wait: wait) @retry_count += 1 @retry_result = call(*args) end
retry_on(*exception, wait: 1.second, attempts: 3) { |self, error| ... }
click to toggle source
# File lib/my_api_client/exceptions.rb, line 28 def retry_on(*exception, wait: 1.second, attempts: 3) rescue_from(*exception) do |error| if retry_count < attempts retry_calling(wait) elsif block_given? yield self, error else raise error end end end