ETL Exception Handling


The ETL <ToolKit> uses the ANSI/ISO C++ exception mechanism to report errors. It has a specialized error class that it uses to encapsulate the problem details. The exception class provided in ETL is os_advanced_toolkit_error.

To detect and recover from errors in any Recursion Software <ToolKit>, you must use C++ try...catch blocks in your code. Failure to catch an exception causes the global function uncaught_exception() usually followed by a call to terminate(). Both of these global functions are included in your compiler's C++ runtime library, and are not part of any Recursion Software <ToolKit>. The call to terminate() forces your application to abort and is unrecoverable. Recursion Software recommends that you provide your own exception handler that safely shuts down your application if an unexpected error condition is encountered.

The following code fragment illustrates several techniques for handling errors in Recursion Software <ToolKits>.


try 
  {
  char* p = 0; // cause an exception
  if (stringHash.exists(p)) 
    cout << stringHash.top() << endl;

  }
catch( os_advanced_toolkit_error& error ) 
  {
  // This will catch an error generated by the ETL<ToolKit>
  cout << "Caught error:" << endl;
  cout << "\t" << error.what() << endl;
  cout << "\t" << error.description( error.code() ) << endl;
    
  } 
catch( os_toolkit_error& error )
  {
  // This will catch any error generated by the Recursion Software ToolKit,
  // executing the ANSI/ISO components found in Standards.
  cout << "Caught error: " << error.what() << endl;
  }
catch( ... )
  {
  // This catch block will handle any thrown exception, although
  // you are not able to query any information about it. This is
  // often used as a "last resort" to keep your applicrom
  // crashing abnormally.
  }

Copyright©2005-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.