lib/httpx/errors.rb in httpx-0.15.4 vs lib/httpx/errors.rb in httpx-0.16.0
- old
+ new
@@ -1,13 +1,13 @@
# frozen_string_literal: true
module HTTPX
- Error = Class.new(StandardError)
+ class Error < StandardError; end
- UnsupportedSchemeError = Class.new(Error)
+ class UnsupportedSchemeError < Error; end
- TimeoutError = Class.new(Error) do
+ class TimeoutError < Error
attr_reader :timeout
def initialize(timeout, message)
@timeout = timeout
super(message)
@@ -18,31 +18,31 @@
ex.set_backtrace(backtrace)
ex
end
end
- TotalTimeoutError = Class.new(TimeoutError)
+ class TotalTimeoutError < TimeoutError; end
- ConnectTimeoutError = Class.new(TimeoutError)
+ class ConnectTimeoutError < TimeoutError; end
- SettingsTimeoutError = Class.new(TimeoutError)
+ class SettingsTimeoutError < TimeoutError; end
- ResolveTimeoutError = Class.new(TimeoutError)
+ class ResolveTimeoutError < TimeoutError; end
- ResolveError = Class.new(Error)
+ class ResolveError < Error; end
- NativeResolveError = Class.new(ResolveError) do
+ class NativeResolveError < ResolveError
attr_reader :connection, :host
def initialize(connection, host, message = "Can't resolve #{host}")
@connection = connection
@host = host
super(message)
end
end
- HTTPError = Class.new(Error) do
+ class HTTPError < Error
attr_reader :response
def initialize(response)
@response = response
super("HTTP Error: #{@response.status} #{@response.headers}\n#{@response.body}")
@@ -51,7 +51,7 @@
def status
@response.status
end
end
- MisdirectedRequestError = Class.new(HTTPError)
+ class MisdirectedRequestError < HTTPError; end
end