Module: Dynectastic::ErrorTranslator

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

Instance Method Summary collapse

Instance Method Details

#translate_to_exception(dynect_msg) ⇒ Object



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

def translate_to_exception(dynect_msg)
  info, source, code = dynect_msg['INFO'], dynect_msg['SOURCE'], dynect_msg['ERR_CD']
  
  case info
  when /Credentials you entered did not match those in our database/i
    return AuthenticationError.new(info, source, code)
  when /This session already has a job running/i
    return SessionBusy.new(info, source, code)
  end
  
  DynectError.new(info, source, code)
end