Sha256: 45d878d2883141115971077c55baaf067ccf4803dc82ec5aa3c612fb011ad40e
Contents?: true
Size: 700 Bytes
Versions: 5
Compression:
Stored size: 700 Bytes
Contents
require 'faraday' require 'capgun/error/bad_gateway' require 'capgun/error/internal_server_error' require 'capgun/error/service_unavailable' module Capgun module Response class RaiseServerError < Faraday::Response::Middleware def on_complete(env) case env[:status].to_i when 500 raise Capgun::Error::InternalServerError.new("Something is technically wrong.", env[:response_headers]) when 502 raise Capgun::Error::BadGateway.new("Capgun is down!", env[:response_headers]) when 503 raise Capgun::Error::ServiceUnavailable.new("(__-){ Capgun is over capacity.", env[:response_headers]) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems