Updated Exceptions for Error Reporting (markdown) authored by williamfgc's avatar williamfgc
<ol><li><strong>Debug mode:</strong> 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.</li><li><strong>Standard exception:</strong> Throw C++ standard exceptions for error handling, do not throw integers. This is helpful as it allows handling of different exception types in different ways. In rare cases a custom exceptions must be defined/declared.<ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code> throw 1;</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code> throw std::invalid_argument ( &quot;ERROR: group was not
previously declared, in call to Write&quot; );</code></pre></li></ul></li></ul></li><li><strong>Document exceptions:</strong> All error exceptions must start with &quot;ERROR: &quot;. Use informative and precise messages for exception handling to complement the nature of the exception to help the user identify and fix the issue.<ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code> throw std::invalid_argument ( &quot;ERROR: invalid input for CompressionParameter&quot; );</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code> throw std::invalid_argument( &quot;ERROR: bzip2 CompressionParameter
must be an unsigned int between 0 and 9,
previously declared, in call to Write&quot; );</code></pre></li></ul></li></ul></li><li><strong>Document exceptions:</strong> All error exceptions must start with &quot;ERROR: &quot;. Use informative and precise messages for exception handling to complement the nature of the exception to help the user identify and fix the issue.<ul><li><code>Don't</code><ul><li><pre style="border: 0;"><code> throw std::invalid_argument ( &quot;ERROR: invalid input for CompressionParameter&quot; );</code></pre></li></ul></li><li><code>Do</code><ul><li><pre style="border: 0;"><code> throw std::invalid_argument( &quot;ERROR: bzip2
CompressionParameter must be an unsigned int between 0 and 9,
in call to Compress&quot;&quot; );</code></pre></li></ul></li></ul></li></ol>
\ No newline at end of file