Skip to content

Exceptions for Error Reporting

williamfgc edited this page May 4, 2017 · 7 revisions
  1. Debug mode: Exceptions thrown by the code (no by STL functions) must be inside a debug mode condition set in the ADIOS class constructor. Applications are encourages to turn these on when integrating with ADIOS2.

  2. Throw C++ standard exceptions: do not throw integers. This is helpful as it allows handling of different exception types in different ways.

    • Don't

      throw 1;
    • Do

      throw std::invalid_argument ( "ERROR: variable + variableName + "was not   
                                     previously declared, in call to Write;" );
  3. Document exceptions: All error exceptions must start with "ERROR: ". Use informative and precise messages to help the user identify and fix the issue.

    • Don't
      throw std::invalid_argument( "ERROR: invalid input for bzip2_blockSize100K" );
    • Do
      throw std::invalid_argument( "ERROR: bzip2_blockSize100K parameters 
                                    must be between 0 and 9,  
                                    in call to AddTransform"  );