Error/exception handling improvements.
authorTeemu Murtola <teemu.murtola@gmail.com>
Mon, 4 Jun 2012 05:10:09 +0000 (08:10 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 3 Jul 2012 23:25:15 +0000 (01:25 +0200)
commit14fd0b7b4cfd55419675e09b26b8905fff90fe60
tree71f05825ce2b9d47699b2e12cd36dbe69e01fadd
parentd39f6dadfabfd11c1753d6c6dcd607b18b5efb1c
Error/exception handling improvements.

- Change formatErrorMessage() to printFatalErrorMessage() that directly
  prints the error message for an exception into a FILE (typically
  stderr) instead of creating a std::string.  This makes it possible to
  handle out-of-memory errors internally within the function.
  The function is much easier to use if we can guarantee that it never
  throws.
- Add basic handling of std::bad_alloc into the above function.
- Resolve clang warnings in the function.
- Add a macro for conveniently catching all exceptions at C++ - C
  boundary and reporting them as fatal errors.
- Initialize ProgramInfo in all C++ binaries.

Related to #838.

Change-Id: I77c355480485f563c57b6c6ea9b07a8ce7f433a8
14 files changed:
share/template/template.cpp
src/gromacs/commandline/cmdlinemodulemanager.h
src/gromacs/gmxlib/wman.cpp
src/gromacs/trajectoryanalysis.h
src/gromacs/trajectoryanalysis/tests/test_selection.cpp
src/gromacs/utility/errorcodes.cpp
src/gromacs/utility/errorformat.cpp
src/gromacs/utility/errorformat.h
src/gromacs/utility/exceptions.cpp
src/gromacs/utility/exceptions.h
src/gromacs/utility/gmxassert.cpp
src/gromacs/utility/programinfo.cpp
src/programs/g_ana/g_ana.cpp
src/testutils/testoptions.cpp