Sha256: c8dd2a4c645a136e69821905104ca4c4a3bb5954e5e74a76ef3d985a8ff19615

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

module Yoti
  # Raises exceptions related to Protobuf decoding
  class ProtobufError < StandardError; end

  # Raises exceptions related to API requests
  class RequestError < StandardError
    attr_reader :response

    def initialize(message, response = nil)
      super(append_response_message(message, response))
      @response = response
    end

    private

    def append_response_message(message, response)
      return message if response.nil? || response.body.empty?

      "#{message}: #{response.body}"
    end
  end

  # Raises exceptions related to OpenSSL actions
  class SslError < StandardError; end

  # Raises exceptions related to an incorrect gem configuration value
  class ConfigurationError < StandardError; end

  # Raises exceptions related to AML actions
  class AmlError < StandardError; end

  # Raises exceptions related to Profile actions
  class ProfileError < StandardError; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yoti-1.7.1 lib/yoti/errors.rb
yoti-1.7.0 lib/yoti/errors.rb