def handle_exception(e)
    raise e unless defined?(e.response) && e.response != nil

    code = e.response[:status]
    error = Nokogiri::XML(e.response[:body])

    message = if error.xpath("m:error/m:message", @ds_namespaces).first
                error.xpath("m:error/m:message", @ds_namespaces).first.content
              else
                "Server returned error but no message."
              end
    raise ServiceError.new(code), message
  end
def handle_exception(e)
    raise e unless defined?(e.response) && e.response != nil

    code = e.response[:status]
    error = Nokogiri::XML(e.response[:body])

    message = if error.xpath("m:error/m:message", @ds_namespaces).first
                error.xpath("m:error/m:message", @ds_namespaces).first.content
              else
                "Server returned error but no message."
              end
    raise ServiceError.new(code), message
  end
Handles errors from the OData service