Sha256: 3b4ab148edb4cb0e3b7e6852fb8e53bcf347cb5b719f27e1d59efd9d926714c9

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Files
  class Error < StandardError
    attr_accessor :response

    attr_reader :code
    attr_reader :http_body
    attr_reader :http_headers
    attr_reader :http_status
    attr_reader :json_body
    attr_reader :message
    attr_reader :request_id

    def initialize(message = nil, http_status: nil, http_body: nil, json_body: nil, http_headers: nil, code: nil)
      @message = message
      @http_status = http_status
      @http_body = http_body
      @http_headers = http_headers || {}
      @json_body = json_body
      @code = code
    end

    def to_s
      "#{@http_status.nil? ? "" : "[HTTP #{@http_status}] "}#{@message}"
    end
  end

  class APIError < Error; end
  class AuthenticationError < Error; end
  class ConnectionError < Error; end
  class InvalidRequestError < Error; end
  class NotImplementedError < Error; end
  class PermissionError < Error; end
  class TooManyRequestsError < Error; end
  class ValidationError < Error; end

  class InvalidParameterError < InvalidRequestError; end
  class MissingParameterError < InvalidRequestError; end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
files.com-1.0.22 lib/files.com/errors.rb
files.com-1.0.21 lib/files.com/errors.rb
files.com-1.0.20 lib/files.com/errors.rb
files.com-1.0.19 lib/files.com/errors.rb
files.com-1.0.18 lib/files.com/errors.rb
files.com-1.0.17 lib/files.com/errors.rb
files.com-1.0.16 lib/files.com/errors.rb
files.com-1.0.15 lib/files.com/errors.rb
files.com-1.0.14 lib/files.com/errors.rb
files.com-1.0.13 lib/files.com/errors.rb
files.com-1.0.12 lib/files.com/errors.rb
files.com-1.0.11 lib/files.com/errors.rb
files.com-1.0.10 lib/files.com/errors.rb
files.com-1.0.9 lib/files.com/errors.rb
files.com-1.0.8 lib/files.com/errors.rb
files.com-1.0.7 lib/files.com/errors.rb