Class: Percy::Client::Connection::NiceErrorMiddleware
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Percy::Client::Connection::NiceErrorMiddleware
- Defined in:
- lib/percy/client/connection.rb
Constant Summary collapse
- CLIENT_ERROR_STATUS_RANGE =
400...600
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/percy/client/connection.rb', line 22 def on_complete(env) case env[:status] when 407 # Mimic the behavior that we get with proxy requests with HTTPS. raise Faraday::Error::ConnectionFailed, %{407 "Proxy Authentication Required "} when CLIENT_ERROR_STATUS_RANGE raise Percy::Client::ClientError.new( env, "Got #{env.status} (#{env.method.upcase} #{env.url}):\n#{env.body}") end end |