TfBaseException Class Reference

The base class for exceptions supported by the Tf exceptions facilities. More...

+ Inheritance diagram for TfBaseException:

Public Member Functions

TF_API TfBaseException (std::string const &message)
 Construct with message, reported by this class's what() implementation. More...
 
TfCallContext const & GetThrowContext () const
 Return the call context from the throw point associated with this exception. More...
 
std::vector< uintptr_t > const & GetThrowStack () const
 Return the stack frame pointers from the throw point. More...
 
void MoveThrowStackTo (std::vector< uintptr_t > &out)
 Move the stack frame pointers from the throw point to out. More...
 
virtual TF_API const char * what () const noexcept override
 Override std::exception::what() to return the message passed during construction. More...
 

Detailed Description

The base class for exceptions supported by the Tf exceptions facilities.

Typical usage is to publically derive your own exception class from this one, and throw using the TF_THROW() macro.

Deriving this base class and throwing via TF_THROW() will record the throw point's call context (see GetThrowContext()) and will also capture a portion of the throwing thread's call stack (see GetThrowStack()).

Additionally, the Tf library registers an exception translator with boost.python to raise a Python exeption wrapping the thrown exception object. Similarly utilties that call Python via Tf will re-throw the embedded C++ exception if the Python exception unwinds back into C++.

Definition at line 63 of file exception.h.

Constructor & Destructor Documentation

◆ TfBaseException()

TF_API TfBaseException ( std::string const &  message)
explicit

Construct with message, reported by this class's what() implementation.

Member Function Documentation

◆ GetThrowContext()

TfCallContext const& GetThrowContext ( ) const
inline

Return the call context from the throw point associated with this exception.

Note that this context may be invalid if this exception was not thrown with TF_THROW().

Definition at line 77 of file exception.h.

◆ GetThrowStack()

std::vector<uintptr_t> const& GetThrowStack ( ) const
inline

Return the stack frame pointers from the throw point.

See ArchPrintStackFrames() to turn these into human-readable strings.

Definition at line 83 of file exception.h.

◆ MoveThrowStackTo()

void MoveThrowStackTo ( std::vector< uintptr_t > &  out)
inline

Move the stack frame pointers from the throw point to out.

See GetThrowStack() for more details.

Definition at line 89 of file exception.h.

◆ what()

virtual TF_API const char* what ( ) const
overridevirtualnoexcept

Override std::exception::what() to return the message passed during construction.


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