Sha256: 379f54105b98ddb4e06ee405e293459bf4abc976d21932acf97258ed007b7122
Contents?: true
Size: 911 Bytes
Versions: 4
Compression:
Stored size: 911 Bytes
Contents
# frozen_string_literal: true module Dnsimple class Error < StandardError end # RequestError is raised when an API request fails for an client, a server error or invalid request information. class RequestError < Error attr_reader :http_response def initialize(http_response) @http_response = http_response super(message_from(http_response)) end private def message_from(http_response) content_type = http_response.headers["Content-Type"] if content_type && content_type.start_with?("application/json") http_response.parsed_response["message"] else net_http_response = http_response.response "#{net_http_response.code} #{net_http_response.message}" end end end class NotFoundError < RequestError end class AuthenticationError < Error end class AuthenticationFailed < AuthenticationError end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dnsimple-6.0.0 | lib/dnsimple/error.rb |
dnsimple-5.2.0 | lib/dnsimple/error.rb |
dnsimple-5.1.0 | lib/dnsimple/error.rb |
dnsimple-5.0.0 | lib/dnsimple/error.rb |