Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::Error Class Reference

class intended for the use in throw statements More...

Inheritance diagram for dg::Error:
[legend]

Public Member Functions

 Error (const Message &message)
 Constructor. More...
 
std::string get_message () const
 
void append (const Message &message)
 Appends a message verbatim to the what string. More...
 
void append_line (const Message &message)
 Appends a newline and a message verbatim to the what string. More...
 
virtual const char * what () const throw ()
 
virtual ~Error () throw ()
 

Detailed Description

class intended for the use in throw statements

The objects of this class store a message (that describes the error when thrown) that can then be displayed in a catch block

try{ throw Error(Message(_ping_)<<"This is error number "<<number);}
catch( Error& m) {std::cerr << m.what();}
Error(const Message &message)
Constructor.
Definition: exceptions.h:92
#define _ping_
Definition: exceptions.h:12

Constructor & Destructor Documentation

◆ Error()

dg::Error::Error ( const Message message)
inline

Constructor.

Parameters
messageAn instance of a Message class

◆ ~Error()

virtual dg::Error::~Error ( )
throw (
)
inlinevirtual

Member Function Documentation

◆ append()

void dg::Error::append ( const Message message)
inline

Appends a message verbatim to the what string.

Parameters
messagemessage to append

◆ append_line()

void dg::Error::append_line ( const Message message)
inline

Appends a newline and a message verbatim to the what string.

Parameters
messagemessage to append after newline

◆ get_message()

std::string dg::Error::get_message ( ) const
inline

◆ what()

virtual const char * dg::Error::what ( ) const
throw (
)
inlinevirtual
Returns
file, line and the message given in the constructor as a string of char

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