Class: Busibe::Error::RaiseServerError

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

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/busibe/error/raise_server_error.rb', line 7

def on_complete(env)
  status  = env[:status].to_i
  headers = env[:response_headers]

  case status
  when 503
    message = "503 No server is available to handle this request."
    raise Busibe::Error::ServiceUnavailable.new message, headers
  end
end