Class documentation of Concepts

Loading...
Searching...
No Matches

#include <exceptions.hh>

Inheritance diagram for concepts::ExceptionBase:
concepts::OutputOperator bem::NoOfIntegrationPointsToHigh cluster::CacheSizeExceeded concepts::DimensionMismatch concepts::ElementNotInDomainOfFormula concepts::Ez4uException concepts::FFEF_Error concepts::FluxesError concepts::GmshInputException concepts::ImplicitEquilibratedA0Error concepts::IndexNotExisting concepts::MatfileIOError concepts::MatrixNotBuilt concepts::MissingFeature concepts::ModelNotSolved concepts::NoMPIInit_Error concepts::NotValidDof concepts::PointerToEmptyBilinearForm concepts::PointerToEmptyElementFormula concepts::PointerToEmptyFormula concepts::SpaceNotBuilt concepts::StrategyChange concepts::WrongInputException concepts::WrongRelations hp2D::NotConnectedIndex parallel::MissingDataType vectorial::ElementNotBuilt

Public Member Functions

 ExceptionBase () throw ()
 Default constructor.
 
 ExceptionBase (const std::string &message) throw ()
 
 ExceptionBase (const std::string &file, const unsigned int line, const std::string &function, const std::string &excName) throw ()
 
void setFields (const std::string &file, const unsigned int line, const std::string &function, const std::string &excName) throw ()
 

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const throw ()
 Returns information in an output stream.
 

Protected Attributes

std::string file_
 Filename where the exception was thrown from.
 
unsigned int line_
 Line where the exception was thrown from.
 
std::string function_
 Name of the function that threw the exception.
 
std::string excName_
 The name of the exception with calling sequence.
 

Detailed Description

Base class for exceptions. This class features informations about the exceptions thrown, ie. filename and line, name of the function and of the exception. The ouput operator (<<) can display this information.

The typical usage of this class is to throw an exception if an error has occured. This can be done by

throw conceptsException(ExceptionBase());

These exceptions are always present (in a production code as well as in development code). If you want to have assertions using exceptions (which are only in the development code), have a look at Assertion and conceptsAssert.

There are two different error cases:

  • The error is a real programming error and should not happen during normal and correct operation. Such an error is caught with an assertion. Such an assertion can be thrown (using an exception) by
    conceptsAssert(1 == 0, Assertion());
    These assertions are not working with the optimised version of the library
  • An error which can also happen during normal operation of the library which should also be detected in optimised mode. Such an error is caught with a normal throw. To use to provided classes comfortably, use the macro conceptsException like this:
    throw conceptsException(ExceptionBase());
See also
conceptsException
conceptsAssert
Assertion
Test:
test::ExceptionTest
Author
Philipp Frauenfelder, 2000
Robert Gruhlke, 2016
Examples
BGT_0.cc, RobinBCs.cc, arpackppTutorial.cc, cig_load_input_data.cc, elasticity2D_tutorial.cc, exactDtN.cc, hpFEM2d-simple.cc, hpFEM2d.cc, hpFEM3d-EV.cc, inhomDirichletBCs.cc, inhomDirichletBCsLagrange.cc, inhomNeumannBCs.cc, inputoutput.cc, linearDG1d.cc, linearFEM1d-simple.cc, linearFEM1d.cc, and matfileTutorial.cc.

Definition at line 84 of file exceptions.hh.

Constructor & Destructor Documentation

◆ ExceptionBase() [1/2]

concepts::ExceptionBase::ExceptionBase ( const std::string &  message)
throw (
)
inline

Definition at line 91 of file exceptions.hh.

◆ ExceptionBase() [2/2]

concepts::ExceptionBase::ExceptionBase ( const std::string &  file,
const unsigned int  line,
const std::string &  function,
const std::string &  excName 
)
throw (
)

Constructor.

Parameters
fileFilename where the exception was thrown from
lineLine where the exception was thrown from
functionName of the function that threw the exception
excNameThe name of the exception

Member Function Documentation

◆ info()

◆ setFields()

void concepts::ExceptionBase::setFields ( const std::string &  file,
const unsigned int  line,
const std::string &  function,
const std::string &  excName 
)
throw (
)

Sets the fields of this exception.

Parameters
fileFilename where the exception was thrown from
lineLine where the exception was thrown from
functionName of the function that threw the exception
excNameThe name of the exception

Member Data Documentation

◆ excName_

std::string concepts::ExceptionBase::excName_
protected

The name of the exception with calling sequence.

Definition at line 132 of file exceptions.hh.

◆ file_

std::string concepts::ExceptionBase::file_
protected

Filename where the exception was thrown from.

Definition at line 123 of file exceptions.hh.

◆ function_

std::string concepts::ExceptionBase::function_
protected

Name of the function that threw the exception.

Definition at line 129 of file exceptions.hh.

◆ line_

unsigned int concepts::ExceptionBase::line_
protected

Line where the exception was thrown from.

Definition at line 126 of file exceptions.hh.


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