module Fluent::Counter

Public Class Methods

raise_error(response) click to toggle source
# File lib/fluent/counter/error.rb, line 65
def raise_error(response)
  msg = response['message']
  case response['code']
  when 'invalid_params'
    raise InvalidParams.new(msg)
  when 'unknown_key'
    raise UnknownKey.new(msg)
  when 'parse_error'
    raise ParseError.new(msg)
  when 'invalid_request'
    raise InvalidRequest.new(msg)
  when 'method_not_found'
    raise MethodNotFound.new(msg)
  when 'internal_server_error'
    raise InternalServerError.new(msg)
  else
    raise "Unknown code: #{response['code']}"
  end
end

Private Instance Methods

raise_error(response) click to toggle source
# File lib/fluent/counter/error.rb, line 65
def raise_error(response)
  msg = response['message']
  case response['code']
  when 'invalid_params'
    raise InvalidParams.new(msg)
  when 'unknown_key'
    raise UnknownKey.new(msg)
  when 'parse_error'
    raise ParseError.new(msg)
  when 'invalid_request'
    raise InvalidRequest.new(msg)
  when 'method_not_found'
    raise MethodNotFound.new(msg)
  when 'internal_server_error'
    raise InternalServerError.new(msg)
  else
    raise "Unknown code: #{response['code']}"
  end
end