Sha256: b780b2e99581f8cb14a750e4e133e96aaf8f62797f5dc8056cd86d325310dd59
Contents?: true
Size: 1.06 KB
Versions: 11
Compression:
Stored size: 1.06 KB
Contents
# tested via spec/core/middleware/response/raise_error_spec.rb module ZendeskAPI module Error class ClientError < Faraday::ClientError attr_reader :wrapped_exception def to_s if response "#{super} -- #{response.method} #{response.url}" else super end end end class RecordInvalid < ClientError attr_accessor :errors def initialize(*) super if response[:body].is_a?(Hash) @errors = response[:body]["details"] || generate_error_msg(response[:body]) end @errors ||= {} end def to_s "#{self.class.name}: #{@errors}" end private def generate_error_msg(response_body) return unless response_body["description"] || response_body["message"] [ response_body["description"], response_body["message"] ].compact.join(" - ") end end class NetworkError < ClientError; end class RecordNotFound < ClientError; end class RateLimited < ClientError; end end end
Version data entries
11 entries across 11 versions & 2 rubygems