Module: Sifterology::ErrorTranslator

Extended by:
ErrorTranslator
Included in:
ErrorTranslator
Defined in:
lib/sifterology/error_translator.rb

Instance Method Summary collapse

Instance Method Details

#translate_to_exception(sifter_message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sifterology/error_translator.rb', line 7

def translate_to_exception(sifter_message)
  case sifter_message
  when /Secure Connection Required/i
    return SSLRequired.new(sifter_message)
  when /Invalid Token/i
    return InvalidToken.new(sifter_message)
  when /Invalid Account/i
    return InvalidAccount.new(sifter_message)
  end
  
  SifterError.new(sifter_message)
end