Class: Hextech::Errors

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/hextech/errors.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/hextech/errors.rb', line 6

def on_complete(env)
  case env[:status]
  when 403
    raise Hextech::Forbidden, 'You may not have the rights to perform this action or your API key may have expired.'
  when 404
    raise Hextech::NotFound, 'Resource not found.'
  when 429
    raise Hextech::RateLimitExceeded, 'Too many requests have exceeded your designated rate limit.'
  end
end