2 class Error < StandardError; end
3 class MissingDependency < Error; end
5 class ClientError < Error
8 def initialize(ex, response = nil)
9 @wrapped_exception = nil
12 if ex.respond_to?(:backtrace)
14 @wrapped_exception = ex
15 elsif ex.respond_to?(:each_key)
16 super("the server responded with status #{ex[:status]}")
25 @wrapped_exception.backtrace
36 class ConnectionFailed < ClientError; end
37 class ResourceNotFound < ClientError; end
38 class ParsingError < ClientError; end
40 class TimeoutError < ClientError
41 def initialize(ex = nil)
42 super(ex || "timeout")
46 class SSLError < ClientError
49 [:MissingDependency, :ClientError, :ConnectionFailed, :ResourceNotFound,
50 :ParsingError, :TimeoutError, :SSLError].each do |const|
51 Error.const_set(const, Faraday.const_get(const))