Class: PDC::Response::RaiseError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/pdc/http/response/raise_error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



5
6
7
# File 'lib/pdc/http/response/raise_error.rb', line 5

def on_complete(env)
  raise PDC::ResourceNotFound, response_values(env) if env[:status] == 404
end

#response_values(env) ⇒ Object



9
10
11
# File 'lib/pdc/http/response/raise_error.rb', line 9

def response_values(env)
  { response: env.response, request: env.request }
end