Sha256: fdc47cea4e90bd3a6890cc340af05534dc640a27daabb2a79ad42a7d441ec943

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

module WithingsSDK
  # 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

1 entries across 1 versions & 1 rubygems

Version Path
withings-sdk-0.2.1 lib/withings-sdk/error.rb