Sha256: 9dd24b72e52246b760498b2b28356a4a679d55023124e93c6faa47151fd92ac7

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

module XeroGateway
  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 CreditNoteNotFoundError < StandardError; end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
xero_gateway-float-2.0.18 lib/xero_gateway/exceptions.rb
xero_gateway-float-2.0.17 lib/xero_gateway/exceptions.rb
xero_gateway-float-2.0.16 lib/xero_gateway/exceptions.rb
xero_gateway-float-2.0.15 lib/xero_gateway/exceptions.rb
xero_gateway-2.0.14 lib/xero_gateway/exceptions.rb