Class: Flattr::Response::RaiseServerError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/flattr/response/raise_server_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/flattr/response/raise_server_error.rb', line 9

def on_complete(env)
  case env[:status].to_i
  when 500
    raise Flattr::Error::InternalServerError.new("Something is technically wrong.", env[:response_headers])
  when 502
    raise Flattr::Error::BadGateway.new("Flattr is down or being upgraded.", env[:response_headers])
  end
end