Sha256: 917eb3a21a6e7d7dbd67c3664e7fae9f7fafaad8f57bb2fbde84a7e0e213127f

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 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 CreditNoteNotFoundError < StandardError; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xero_gateway-2.0.13 lib/xero_gateway/exceptions.rb
xero_gateway-2.0.12 lib/xero_gateway/exceptions.rb
xero_gateway-2.0.11 lib/xero_gateway/exceptions.rb
xero_gateway-2.0.10 lib/xero_gateway/exceptions.rb
xero_gateway-2.0.9 lib/xero_gateway/exceptions.rb