Flow123d  JS_before_hm-1008-g3dab983
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ExceptionBase Class Referenceabstract

Base of exceptions used in Flow123d. More...

#include <exceptions.hh>

Inheritance diagram for ExceptionBase:
Inheritance graph
[legend]
Collaboration diagram for ExceptionBase:
Collaboration graph
[legend]

Public Member Functions

 ExceptionBase ()
 Default constructor, just calls fill_stacktrace(). More...
 
 ExceptionBase (const ExceptionBase &other)
 Copy constructor, performs deep copy of stacktrace. More...
 
void print_stacktrace (std::ostream &out) const
 Prints formated stacktrace into given stream out. More...
 
virtual void print_info (std::ostringstream &out) const =0
 
const char * what () const throw ()
 
virtual ~ExceptionBase () throw ()
 Destructor, possibly free stacktrace. More...
 

Protected Member Functions

virtual std::string what_type_msg () const
 Return type of message ("Program error" for this class). Can be override in descendants. More...
 
virtual std::ostringstream & form_message (std::ostringstream &) const
 

Protected Attributes

StackTrace stack_trace_
 Stacktrace of exception. More...
 
std::vector< std::string > frames_to_cut_
 Stacktrace frames, which will be cut, see StackTrace::print method. More...
 

Detailed Description

Base of exceptions used in Flow123d.

We use boost::exception as parent in order to allow passing some data through the exception object from the throw point to the catch point. See DECLARE_EXCEPTION macro for usage.

When deriving particular exceptions always use virtual inheritance:

struct my_exception : virtual ExceptionBase {};

Definition at line 75 of file exceptions.hh.

Constructor & Destructor Documentation

ExceptionBase::ExceptionBase ( )

Default constructor, just calls fill_stacktrace().

Definition at line 25 of file exceptions.cc.

ExceptionBase::ExceptionBase ( const ExceptionBase other)

Copy constructor, performs deep copy of stacktrace.

Definition at line 31 of file exceptions.cc.

ExceptionBase::~ExceptionBase ( )
throw (
)
virtual

Destructor, possibly free stacktrace.

Definition at line 37 of file exceptions.cc.

Member Function Documentation

std::ostringstream & ExceptionBase::form_message ( std::ostringstream &  converter) const
protectedvirtual

Method for output the exception message. Implements composition of complex message including diagnostic informations and stack trace.

Reimplemented in feal::Exc_assert, and Input::Exception.

Definition at line 101 of file exceptions.cc.

Here is the caller graph for this function:

virtual void ExceptionBase::print_info ( std::ostringstream &  out) const
pure virtual

Purely virtual method, that should be implemented by descendants. Prints specific error message into stream out. In particular you can use macros DECLARE_EXCEPTION or DECLARE_INPUT_EXCEPTION for easy declarations.

Implemented in feal::Exc_assert, and ExcArmadillo.

Here is the caller graph for this function:

void ExceptionBase::print_stacktrace ( std::ostream &  out) const

Prints formated stacktrace into given stream out.

Definition at line 42 of file exceptions.cc.

Here is the caller graph for this function:

const char * ExceptionBase::what ( ) const
throw (
)

Overloaded method for output the exception message if it is not catched. Creates envelope of form_message method. Should not be overloded in descendant classes. Use form_message instead.

Definition at line 47 of file exceptions.cc.

std::string ExceptionBase::what_type_msg ( ) const
protectedvirtual

Return type of message ("Program error" for this class). Can be override in descendants.

Reimplemented in feal::Exc_assert.

Definition at line 96 of file exceptions.cc.

Here is the caller graph for this function:

Member Data Documentation

std::vector<std::string> ExceptionBase::frames_to_cut_
protected

Stacktrace frames, which will be cut, see StackTrace::print method.

Definition at line 109 of file exceptions.hh.

StackTrace ExceptionBase::stack_trace_
protected

Stacktrace of exception.

Definition at line 107 of file exceptions.hh.


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