WARPXM v1.10.0
Loading...
Searching...
No Matches
wxm::lib::Except Class Reference

wxm::lib::Except is the class to use for creating and throwing exceptions. More...

#include <wxexcept.h>

Inheritance diagram for wxm::lib::Except:

Detailed Description

wxm::lib::Except is the class to use for creating and throwing exceptions.

It supports the standard I/O library operators to create the exception messages. For example, one can do

wxm::lib::Warpx:Except ex("An exception "); ex << "occured at line " << 25 << std::endl;

Public Member Functions

 Except ()
 Creates a new exception object with empty message and backtrace.
 
 Except (const std::string &str)
 Creates new exception with supplied message.
 
 Except (Except &&ex)=default
 
 Except (const Except &ex)
 Copies exception and backtrace from supplied exception object.
 
 ~Except () override=default
 Deletes exception.
 
Exceptoperator= (const Except &ex)
 Assigns from supplied exception object.
 
const char * what () const noexcept override
 Returns error message: this is provided for compatibility with std::exception interface.
 
template<typename T >
Exceptoperator<< (const T &ex)
 Inserts an element into the output message.
 
Exceptoperator<< (std::ostream &(*p)(std::ostream &))
 Inserts iomanip element into the output message.
 
const std::vector< std::string > & get_stack_trace () const
 This returns the stack trace.
 

Constructor & Destructor Documentation

◆ Except() [1/4]

wxm::lib::Except::Except ( )

Creates a new exception object with empty message and backtrace.

◆ Except() [2/4]

wxm::lib::Except::Except ( const std::string &  str)

Creates new exception with supplied message.

Parameters
strexception message.

◆ Except() [3/4]

wxm::lib::Except::Except ( Except &&  ex)
default

◆ Except() [4/4]

wxm::lib::Except::Except ( const Except ex)

Copies exception and backtrace from supplied exception object.

Parameters
exException to copy from

◆ ~Except()

wxm::lib::Except::~Except ( )
overridedefault

Deletes exception.

Member Function Documentation

◆ get_stack_trace()

const std::vector< std::string > & wxm::lib::Except::get_stack_trace ( ) const

This returns the stack trace.

Added feature not included in std:exception.

Returns
Stack trace.

◆ operator<<() [1/2]

template<typename T >
Except & wxm::lib::Except::operator<< ( const T &  ex)
inline

Inserts an element into the output message.

Parameters
exElement to insert.
Returns
reference to this class.

◆ operator<<() [2/2]

Except & wxm::lib::Except::operator<< ( std::ostream &(*)(std::ostream &)  p)
inline

Inserts iomanip element into the output message.

Parameters
pIomanip element to insert.
Returns
reference to this class.

◆ operator=()

Except & wxm::lib::Except::operator= ( const Except ex)

Assigns from supplied exception object.

Parameters
exException to copy from

◆ what()

const char * wxm::lib::Except::what ( ) const
overridenoexcept

Returns error message: this is provided for compatibility with std::exception interface.

Returns
Message from exception.

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