Sha256: 8b63a8e0033636fb69d84ab03cfe0febf17a37f1f21cb5cdb8501a94fa5310e8

Contents?: true

Size: 678 Bytes

Versions: 10

Compression:

Stored size: 678 Bytes

Contents

module MangoPay

  # Generic error superclass for MangoPay specific errors.
  # Currently never instantiated directly.
  # Currently only single subclass used.
  class Error < StandardError
  end

  # Thrown from any MangoPay API call whenever
  # it returns response with HTTP code != 200.
  class ResponseError < Error

    attr_reader :request_url, :code, :details

    def initialize(request_url, code, details)
      @request_url, @code, @details = request_url, code, details
      super(message) if message
    end

    def message; @details['Message']; end
    def type;    @details['Type']; end
    def errors;  @details['errors']; end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mangopay-3.0.11 lib/mangopay/errors.rb
mangopay-3.0.10 lib/mangopay/errors.rb
mangopay-3.0.9 lib/mangopay/errors.rb
mangopay-3.0.8 lib/mangopay/errors.rb
mangopay-3.0.7 lib/mangopay/errors.rb
mangopay-3.0.6 lib/mangopay/errors.rb
mangopay-3.0.5 lib/mangopay/errors.rb
mangopay-3.0.4 lib/mangopay/errors.rb
mangopay-3.0.3 lib/mangopay/errors.rb
mangopay-3.0.2 lib/mangopay/errors.rb