|
Gromacs
2025.3
|
#include <cstdio>#include <cstdlib>#include <exception>#include <memory>#include <string>#include <type_traits>#include <typeindex>#include <vector>#include "gromacs/utility/basedefinitions.h"#include "gromacs/utility/gmxassert.h"
Include dependency graph for exceptions.h:
This graph shows which files directly or indirectly include this file:Declares common exception classes and macros for fatal error handling.
The basic approach is the same as in boost::exception for storing additional context information to exceptions, but since that functionality is a very small and simple part of boost::exception, the code is duplicated here.
Classes | |
| class | gmx::ExceptionInfo< Tag, T > |
| Stores additional context information for exceptions. More... | |
| class | gmx::ExceptionInitializer |
| Provides information for Gromacs exception constructors. More... | |
| class | gmx::GromacsException |
| Base class for all exception objects in Gromacs. More... | |
| class | gmx::FileIOError |
| Exception class for file I/O errors. More... | |
| class | gmx::UserInputError |
| Exception class for user input errors. More... | |
| class | gmx::InvalidInputError |
| Exception class for situations where user input cannot be parsed/understood. More... | |
| class | gmx::InconsistentInputError |
| Exception class for situations where user input is inconsistent. More... | |
| class | gmx::ToleranceError |
| Exception class when a specified tolerance cannot be achieved. More... | |
| class | gmx::SimulationInstabilityError |
| Exception class for simulation instabilities. More... | |
| class | gmx::InternalError |
| Exception class for internal errors. More... | |
| class | gmx::APIError |
| Exception class for incorrect use of an API. More... | |
| class | gmx::RangeError |
| Exception class for out-of-range values or indices. More... | |
| class | gmx::NotImplementedError |
| Exception class for use of an unimplemented feature. More... | |
| class | gmx::ParallelConsistencyError |
| Exception class for use when ensuring that MPI ranks to throw in a coordinated fashion. More... | |
| class | gmx::ModularSimulatorError |
| Exception class for modular simulator. More... | |
Macros | |
| #define | GMX_THROW(e) throw(e) << gmx::ExceptionInfoLocation(gmx::ThrowLocation(GMX_CURRENT_FUNCTION, __FILE__, __LINE__)) |
| Macro for throwing an exception. More... | |
| #define | GMX_THROW_WITH_ERRNO(e, syscall, err) |
| Macro for throwing an exception based on errno. More... | |
| #define | GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR |
| Macro for catching exceptions at C++ -> C boundary. More... | |
Typedefs | |
|
typedef std::vector < std::exception_ptr > | gmx::internal::NestedExceptionList |
| Internal container type for storing a list of nested exceptions. | |
|
typedef std::unique_ptr < IExceptionInfo > | gmx::internal::ExceptionInfoPointer |
| Smart pointer to manage IExceptionInfo ownership. | |
|
typedef ExceptionInfo< struct ExceptionInfoErrno_, int > | gmx::ExceptionInfoErrno |
Stores errno value that triggered the exception. | |
|
typedef ExceptionInfo< struct ExceptionInfoApiFunc_, const char * > | gmx::ExceptionInfoApiFunction |
Stores the function name that returned the errno in ExceptionInfoErrno. | |
|
typedef ExceptionInfo< struct ExceptionInfoLocation_, ThrowLocation > | gmx::ExceptionInfoLocation |
| Stores the location where the exception was thrown. | |
Functions | |
| template<class Exception , class Tag , class T > | |
| std::enable_if_t < std::is_base_of_v < GromacsException, Exception > , Exception > | gmx::operator<< (Exception ex, const ExceptionInfo< Tag, T > &item) |
| Associates extra information with an exception. More... | |
| void | gmx::printFatalErrorMessage (FILE *fp, const std::exception &ex) |
| Formats a standard fatal error message for reporting an exception. More... | |
| std::string | gmx::formatExceptionMessageToString (const std::exception &ex) |
| Formats an error message for reporting an exception. More... | |
| void | gmx::formatExceptionMessageToFile (FILE *fp, const std::exception &ex) |
| Formats an error message for reporting an exception. More... | |
| void | gmx::formatExceptionMessageToWriter (TextWriter *writer, const std::exception &ex) |
| Formats an error message for reporting an exception. More... | |
| int | gmx::processExceptionAtExit (const std::exception &ex) |
| Handles an exception that is causing the program to terminate. More... | |
| void | gmx::processExceptionAsFatalError (const std::exception &ex) |
| Helper function for terminating the program on an exception. More... | |
1.8.5