ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
Public Member Functions | Friends | List of all members
daq::error::NestedExceptionReporter Class Reference

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

#include <report.hpp>

Public Member Functions

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

Friends

std::ostream & operator<< (std::ostream &os, NestedExceptionReporter const &reporter)
 Formats exception from reporter using ReportNestedExceptions. More...
 

Detailed Description

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

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

Definition at line 54 of file report.hpp.

Constructor & Destructor Documentation

◆ NestedExceptionReporter() [1/2]

daq::error::NestedExceptionReporter::NestedExceptionReporter ( std::exception const &  exception)
inlineexplicitnoexcept

Construct from exception derived from std::exception.

Definition at line 59 of file report.hpp.

◆ NestedExceptionReporter() [2/2]

daq::error::NestedExceptionReporter::NestedExceptionReporter ( std::exception_ptr  ptr)
inlineexplicitnoexcept

Construct from exception_ptr.

Definition at line 64 of file report.hpp.

Member Function Documentation

◆ Str()

std::string daq::error::NestedExceptionReporter::Str ( ) const

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

Returns
Formatted string

Definition at line 97 of file report.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
NestedExceptionReporter const &  reporter 
)
friend

Formats exception from reporter using ReportNestedExceptions.

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

Definition at line 81 of file report.hpp.


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