Class: Pushybullet::Middleware::Error

Inherits:
Faraday::Response::RaiseError
  • Object
show all
Defined in:
lib/pushybullet/middleware/error.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pushybullet/middleware/error.rb', line 8

def on_complete(env)
  case env[:status]
  when 401
    raise Errors::Unauthorized, response_values(env)
  when 403
    raise Errors::Forbidden, response_values(env)
  when 429
    raise Errors::TooManyRequests, response_values(env)
  else
    super
  end
end