Sha256: 55327f57ecbdcc088d82d3a26b9c5c6919ce4752a4a194524bdc9fb4383f8ac5
Contents?: true
Size: 868 Bytes
Versions: 3
Compression:
Stored size: 868 Bytes
Contents
require 'faraday' # @private module Faraday # @private class Response::RaiseHttp5xx < Response::Middleware def on_complete(env) case env[:status].to_i when 500 raise Evrythng::InternalServerError.new(error_message(env, "Something is technically wrong."), env[:response_headers]) when 502 raise Evrythng::BadGateway.new(error_message(env, "Evrythng is down or being upgraded."), env[:response_headers]) when 503 raise Evrythng::ServiceUnavailable.new(error_message(env, "(__-){ Evrythng is over capacity."), env[:response_headers]) end end private def error_message(env, body=nil) "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{[env[:status].to_s + ':', body].compact.join(' ')} Check http://status.evrythng.net/ for updates on the status of the Evrythng service." end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
evrythng-0.0.3 | lib/faraday/response/raise_http_5xx.rb |
evrythng-0.0.2 | lib/faraday/response/raise_http_5xx.rb |
evrythng-0.0.1 | lib/faraday/response/raise_http_5xx.rb |