Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::anonymous_namespace{exceptions.cpp}::ErrorMessage Class Reference

Description

Error message or error context text item.

Error messages for an exception are represented as a chain of ErrorMessage objects: the elements at the bottom of the chain (with no children) is the error message, and other elements are the context strings added.

Public Member Functions

 ErrorMessage (const std::string &text)
 Creates an error message object with the specified text. More...
 
bool isContext () const
 Whether this object is a context string.
 
const std::string & text () const
 Returns the text for this object.
 
const ErrorMessagechild () const
 Returns the child object for a context object. More...
 
ErrorMessage prependContext (const std::string &context) const
 Creates a new message object with context prepended. More...
 

Constructor & Destructor Documentation

gmx::anonymous_namespace{exceptions.cpp}::ErrorMessage::ErrorMessage ( const std::string &  text)
explicit

Creates an error message object with the specified text.

Parameters
[in]textText for the message.

Member Function Documentation

const ErrorMessage& gmx::anonymous_namespace{exceptions.cpp}::ErrorMessage::child ( ) const
inline

Returns the child object for a context object.

Must not be called if isContext() returns false.

ErrorMessage gmx::anonymous_namespace{exceptions.cpp}::ErrorMessage::prependContext ( const std::string &  context) const

Creates a new message object with context prepended.

Parameters
[in]contextContext string to add.
Returns
New error message object that has context as its text and this as its child.
Exceptions
std::bad_allocif out of memory.

The documentation for this class was generated from the following file: