Exception: Net::TTI::Exceptions::ErrorMessageReceived

Inherits:
TTIException
  • Object
show all
Defined in:
lib/net/tti/exceptions.rb

Direct Known Subclasses

AuthenticationError

Constant Summary collapse

ERROR_REGEX =
/ORA\-(\d+)(?:\:\ (.*))?/
ERROR_REGEX_INDEX_CODE =
1
ERROR_REGEX_INDEX_DESCRIPTION =
2

Instance Method Summary collapse

Instance Method Details

#error_codeInteger

Attempts to parse and return the “ORA-xxxxx” error code from the error message

Returns:

  • (Integer)

    A numeric error code, or nil if the code could not be determined



39
40
41
42
43
44
# File 'lib/net/tti/exceptions.rb', line 39

def error_code()
  matches = ERROR_REGEX.match( self.message )
  error_code = matches[ERROR_REGEX_INDEX_CODE] unless( matches.nil? or matches[ERROR_REGEX_INDEX_CODE].nil? )
  error_code = error_code.to_i unless error_code.nil?
  return error_code
end

#error_descriptionString

Attempts to parse and return the error description after the “ORA-xxxxx” error code in the error message

Returns:

  • (String)

    A string containing the error description, or nil if the description could not be determined



50
51
52
53
# File 'lib/net/tti/exceptions.rb', line 50

def error_description()
  matches = ERROR_REGEX.match( self.message )
  return matches[ERROR_REGEX_INDEX_DESCRIPTION] unless( matches.nil? or matches[ERROR_REGEX_INDEX_DESCRIPTION].nil? )
end