Public Member Functions | Private Attributes | List of all members
ecl::DataException< Data > Class Template Reference

Extended exception class that bundles location, message and data. More...

#include <data_exception.hpp>

Inheritance diagram for ecl::DataException< Data >:
Inheritance graph
[legend]

Public Member Functions

 DataException (const char *loc, const DataException< Data > &e)
 
 DataException (const char *loc, ErrorFlag error, const std::string &msg, const Data &d)
 
 DataException (const char *loc, ErrorFlag error, Data &d)
 
const char * what () const throw ()
 
virtual ~DataException () throw ()
 

Private Attributes

Data error_data
 
ErrorFlag error_type
 
std::string message
 

Additional Inherited Members

- Protected Member Functions inherited from ecl::Exception
 Exception ()
 
 Exception (const char *loc)
 
- Protected Attributes inherited from ecl::Exception
std::string location
 

Detailed Description

template<typename Data>
class ecl::DataException< Data >

Extended exception class that bundles location, message and data.

This exception class extends the StandardException to include an additional component, a single data object. Usually its a good idea to keep the data object small - it is copied into the exception so that it cannot be lost if the original object should die.

The bundled data object must be streamable to standard output if this class is going to utilise the generic what() output.

See also
Exception, StandardException, Exceptions Guide.

Definition at line 66 of file data_exception.hpp.

Constructor & Destructor Documentation

◆ DataException() [1/3]

template<typename Data >
ecl::DataException< Data >::DataException ( const char *  loc,
ErrorFlag  error,
Data &  d 
)

Default constructor for data exceptions.

Parameters
loc: use with the LOC macro, identifies the line and file of the code.
error: enumerated exception error type.
d: the data bundled with the exception.

Definition at line 96 of file data_exception.hpp.

◆ DataException() [2/3]

template<typename Data >
ecl::DataException< Data >::DataException ( const char *  loc,
ErrorFlag  error,
const std::string &  msg,
const Data &  d 
)

Constructor for data exceptions with a custom message.

Parameters
loc: use with the LOC macro, identifies the line and file of the code.
error: enumerated exception error type.
msg: extra detail message.
d: the data bundled with the exception.

Definition at line 109 of file data_exception.hpp.

◆ DataException() [3/3]

template<typename Data >
ecl::DataException< Data >::DataException ( const char *  loc,
const DataException< Data > &  e 
)

Constructor for data exceptions that enables rethrowing of an existing exception up the heirarchy with a new code location stamp.

Parameters
loc: use with the LOC macro, identifies the line and file of the code.
e: a caught standard exception that is to be rethrown.

Definition at line 122 of file data_exception.hpp.

◆ ~DataException()

template<typename Data >
virtual ecl::DataException< Data >::~DataException ( )
throw (
)
inlinevirtual

Definition at line 83 of file data_exception.hpp.

Member Function Documentation

◆ what()

template<typename Data >
const char * ecl::DataException< Data >::what
throw (
)
virtual

Default exception handling output function.

Returns
char const* : the output message.

Implements ecl::Exception.

Definition at line 136 of file data_exception.hpp.

Member Data Documentation

◆ error_data

template<typename Data >
Data ecl::DataException< Data >::error_data
private

Definition at line 92 of file data_exception.hpp.

◆ error_type

template<typename Data >
ErrorFlag ecl::DataException< Data >::error_type
private

Definition at line 91 of file data_exception.hpp.

◆ message

template<typename Data >
std::string ecl::DataException< Data >::message
private

Definition at line 93 of file data_exception.hpp.


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


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:17