Sha256: bf704cde4423fe1e3972ad350847b92ee230190119a10b0e88afa56d2ad8d5c8
Contents?: true
Size: 729 Bytes
Versions: 2
Compression:
Stored size: 729 Bytes
Contents
require 'faraday' require 'evrythng/error/bad_gateway' require 'evrythng/error/internal_server_error' require 'evrythng/error/service_unavailable' module Evrythng module Response class RaiseServerError < Faraday::Response::Middleware def on_complete(env) case env[:status].to_i when 500 raise Evrythng::Error::InternalServerError.new("Something is technically wrong.", env[:response_headers]) when 502 raise Evrythng::Error::BadGateway.new("Evrythng is down or being upgraded.", env[:response_headers]) when 503 raise Evrythng::Error::ServiceUnavailable.new("Evrythng is over capacity.", env[:response_headers]) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
evrythng-0.1.1 | lib/evrythng/response/raise_server_error.rb |
evrythng-0.1.0 | lib/evrythng/response/raise_server_error.rb |