Sha256: eed60a900909778cc3ff7335b3a97973e127793bc876b5510d583e22a40f2900

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

module Algolia
  # Base exception class for errors thrown by the Algolia
  # client library. AlgoliaError will be raised by any
  # network operation if Algolia.init() has not been called.
  # Exception ... why? A:http://www.skorks.com/2009/09/ruby-exceptions-and-exception-handling/
  #
  class AlgoliaError < StandardError
  end

  # Used when hosts are unreachable
  #
  class AlgoliaUnreachableHostError < AlgoliaError
  end

  # An exception class raised when the REST API returns an error.
  # The error code and message will be parsed out of the HTTP response,
  # which is also included in the response attribute.
  #
  class AlgoliaHttpError < AlgoliaError
    attr_accessor :code
    attr_accessor :message

    def initialize(code, message)
      self.code    = code
      self.message = message
      super("#{self.code}: #{self.message}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
algolia-2.0.0.pre.beta.1 lib/algolia/error.rb
algolia-2.0.0.pre.alpha.4 lib/algolia/error.rb
algolia-2.0.0.pre.alpha.3 lib/algolia/error.rb
algolia-2.0.0.pre.alpha.2 lib/algolia/error.rb