RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
rtctk::componentFramework::NestedExceptionPrinter Class Reference

Adapter object intended to be used in contexts without direct access to the output-stream object. More...

#include <rtctk/componentFramework/exceptions.hpp>

Public Member Functions

 NestedExceptionPrinter (const std::exception &exception) noexcept
 Construct from exception derived from std::exception.
 
 NestedExceptionPrinter (std::exception_ptr ptr) noexcept
 Construct from exception_ptr.
 
std::string Str () const
 Convenience function for constructing a std::string from the exception.
 

Friends

std::ostream & operator<< (std::ostream &os, const NestedExceptionPrinter &printer)
 Formats exception from printer using PrintNestedExceptions.
 

Detailed Description

Adapter object intended to be used in contexts without direct access to the output-stream object.

try {
  MaybeThrows();
} catch (const std::exception& e) {
  LOG4CPLUS_ERROR(logger, "MaybeThrow failed with:\n" << NestedExceptionPrinter(e));
}

Constructor & Destructor Documentation

◆ NestedExceptionPrinter() [1/2]

rtctk::componentFramework::NestedExceptionPrinter::NestedExceptionPrinter ( const std::exception & exception)
inlineexplicitnoexcept

Construct from exception derived from std::exception.

◆ NestedExceptionPrinter() [2/2]

rtctk::componentFramework::NestedExceptionPrinter::NestedExceptionPrinter ( std::exception_ptr ptr)
inlineexplicitnoexcept

Construct from exception_ptr.

Member Function Documentation

◆ Str()

std::string rtctk::componentFramework::NestedExceptionPrinter::Str ( ) const
inline

Convenience function for constructing a std::string from the exception.

Returns
Formatted string

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const NestedExceptionPrinter & printer )
friend

Formats exception from printer using PrintNestedExceptions.

Parameters
osoutput stream to output to.
printerPrinter adapter to format.
Returns
os

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