Class: Subscene::Response::RaiseError

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

Constant Summary collapse

ClientErrorStatuses =
400...600

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object


5
6
7
8
9
10
# File 'lib/subscene/response/raise_error.rb', line 5

def on_complete(env)
  case env[:status]
  when 301, 302
    raise Subscene::SearchNotSupported, response_values(env)
  end
end

#response_values(env) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/subscene/response/raise_error.rb', line 12

def response_values(env)
  {
    :status  => env[:status],
    :headers => env[:response_headers],
    :body    => env[:body]
  }
end