Sha256: 9a9dba5e8bfb4d42116cff20e53c11fcd91d657e5e7f7b555512ec37f3a4891c
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
module Faraday class Error < StandardError; end class MissingDependency < Error; end class ClientError < Error attr_reader :response def initialize(ex, response = nil) @wrapped_exception = nil @response = response if ex.respond_to?(:backtrace) super(ex.message) @wrapped_exception = ex elsif ex.respond_to?(:each_key) super("the server responded with status #{ex[:status]}") @response = ex else super(ex.to_s) end end def backtrace if @wrapped_exception @wrapped_exception.backtrace else super end end def inspect %(#<#{self.class}>) end end class ConnectionFailed < ClientError; end class ResourceNotFound < ClientError; end class ParsingError < ClientError; end class TimeoutError < ClientError; end [:MissingDependency, :ClientError, :ConnectionFailed, :ResourceNotFound, :ParsingError, :TimeoutError].each do |const| Error.const_set(const, Faraday.const_get(const)) end end
Version data entries
5 entries across 5 versions & 1 rubygems