Sha256: 37740a15d05752d94c35ad6dff6b78de0b88b94bfc4bccbb2ed297baf5b156d3

Contents?: true

Size: 554 Bytes

Versions: 7

Compression:

Stored size: 554 Bytes

Contents

# Delegator class which intercepts exceptions raised by OAuth::AccessToken methods
# and wraps them in [NexaasID::Client::Exception] exceptions.
#
# [API]
#   Documentation:
#
class NexaasID::Client::ExceptionWrapper < SimpleDelegator
  def refresh(*args)
    call_with_rescue { super }
  end

  def request(*args, &block)
    call_with_rescue { super }
  end

  private

  def call_with_rescue
    yield
  rescue Faraday::ClientError, OAuth2::Error => exception
    raise NexaasID::Client::Exception.new(exception.message, exception.response)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nexaas_id-client-0.7.4 lib/nexaas_id/client/exception_wrapper.rb
nexaas_id-client-0.7.3 lib/nexaas_id/client/exception_wrapper.rb
nexaas_id-client-0.7.2 lib/nexaas_id/client/exception_wrapper.rb
nexaas_id-client-0.7.1 lib/nexaas_id/client/exception_wrapper.rb
nexaas_id-client-0.7.0 lib/nexaas_id/client/exception_wrapper.rb
nexaas_id-client-0.6.0 lib/nexaas_id/client/exception_wrapper.rb
nexaas_id-client-0.5.0 lib/nexaas_id/client/exception_wrapper.rb