Exception: Twingly::Search::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Twingly::Search::Error
show all
- Defined in:
- lib/twingly/search/error.rb
Class Method Summary
collapse
Class Method Details
.from_api_response(code, message) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/twingly/search/error.rb', line 6
def self.from_api_response(code, message)
error =
case code.to_s
when /^400/, /^404/
QueryError
when /^401/ AuthenticationError
when /^402/ AuthorizationError
else
ServerError
end
error.new("#{message} (code: #{code})")
end
|