Sha256: a758b20f0a8ead7a5b3c74ee3235c0de783edab594796a9bf503a95ba7777180

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

module RDStation

  class Error < StandardError
    attr_reader :details, :http_status, :headers, :body

    def initialize(details)
      @details = details
      message = details['error_message']
      raise ArgumentError, 'The details hash must contain an error message' unless message

      # Those three arguments are kept only for compatibility reasons.
      # They aren't needed since we can get them directly in the details hash.
      # Consider removing them when update the major version.
      @http_status = details['http_status']
      @headers = details['headers']
      @body = details['body']

      super(message)
    end

    class ConflictingField < Error; end
    class Default < Error; end
    class ExpiredAccessToken < Error; end
    class ExpiredCodeGrant < Error; end
    class InvalidCredentials < Error; end
    class ResourceNotFound < Error; end
    class Unauthorized < Error; end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rdstation-ruby-client-1.0.1 lib/rdstation/error.rb