Sha256: 9bd4e973da71399a30f20ac126c1bee34d7134728ad43c0f8db0622b92cea0b8

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

module XeroGateway
  class NoGatewayError < StandardError; end
  class AccountsListNotLoadedError < StandardError; end
  class InvalidLineItemError < StandardError; end

  class ApiException < StandardError

    def initialize(type, message, request_xml, response_xml)
      @type     = type
      @message  = message
      @request_xml      = request_xml
      @response_xml      = response_xml
    end

    attr_reader :request_xml, :response_xml

    def message
      "#{@type}: #{@message} \n Generated by the following XML: \n #{@response_xml}"
    end

  end

  class UnparseableResponse < StandardError

    def initialize(root_element_name)
      @root_element_name = root_element_name
    end

    def message
      "A root element of #{@root_element_name} was returned, and we don't understand that!"
    end

  end

  class ObjectNotFound < StandardError

    def initialize(api_endpoint)
      @api_endpoint = api_endpoint
    end

    def message
      "Couldn't find object for API Endpoint #{@api_endpoint}"
    end

  end

  class InvoiceNotFoundError < StandardError; end
  class BankTransactionNotFoundError < StandardError; end
  class PaymentNotFoundError < StandardError; end
  class CreditNoteNotFoundError < StandardError; end
  class ManualJournalNotFoundError < StandardError; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xero_gateway-2.7.0 lib/xero_gateway/exceptions.rb
xero_gateway-2.6.0 lib/xero_gateway/exceptions.rb
xero_gateway-2.5.0 lib/xero_gateway/exceptions.rb
xero_gateway-2.4.0 lib/xero_gateway/exceptions.rb
xero_gateway-2.3.0 lib/xero_gateway/exceptions.rb