Sha256: cbdbcf6cde2b42f71da399b4b5869b74d32e4aae6e5bbf7b50695dd573df45bc

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

module Activite
  # Custom errors for rescuing from Withings API errors
  class Error < StandardError
    # @return [Integer]
    attr_reader :code

    # Raised when client is misconfigured
    ClientConfigurationError = Class.new(self)

    # Withings returns 200 for everything, making it difficult to figure out
    # exactly what went wrong. They also appear to send back fairly arbitrary
    # codes, for example a response with an HTTP Status Code 200 can contain
    # a body {"status":503,"error":"Invalid Params"} if OAuth credentials are
    # incorrect (503 normally indicates that a downstream service is unavailable).
    # Because of this we just wrap most errors in this class.
    InvalidResponseError = Class.new(self)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activite-0.2.0 lib/activite/error.rb
activite-0.1.0 lib/activite/error.rb