class Twingly::LiveFeed::Error

Public Class Methods

from_api_response(code, message) click to toggle source
# File lib/twingly/livefeed/error.rb, line 6
def self.from_api_response(code, message)
  error =
    case code.to_s
    when /^400/, /^404/
      QueryError
    when /^401/
      AuthenticationError
    else
      ServerError
    end

  error.new("#{message} (code: #{code})")
end