class Faraday::Retry::Middleware
def build_exception_matcher(exceptions)
-
(Module)
- an exception matcher
Other tags:
- Api: - private
Parameters:
-
exceptions
(Array
) --
def build_exception_matcher(exceptions) matcher = Module.new ( class << matcher self end).class_eval do define_method(:===) do |error| exceptions.any? do |ex| if ex.is_a? Module error.is_a? ex else Object.const_defined?(ex.to_s) && error.is_a?(Object.const_get(ex.to_s)) end end end end matcher end