Sha256: 97b97e32d08e1b0df8c9f53b6710af0e31222b749e7ce00a795730d86c58ebfe
Contents?: true
Size: 880 Bytes
Versions: 9
Compression:
Stored size: 880 Bytes
Contents
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
9 entries across 9 versions & 1 rubygems