ThreadSchedule 1.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::ErrorHandledTask< Func > Class Template Reference

Callable wrapper that catches exceptions and routes them to an ErrorHandler. More...

#include <error_handler.hpp>

Public Member Functions

 ErrorHandledTask (Func &&func, std::shared_ptr< ErrorHandler > handler, std::string description="")
void operator() ()

Detailed Description

template<typename Func>
class threadschedule::ErrorHandledTask< Func >

Callable wrapper that catches exceptions and routes them to an ErrorHandler.

ErrorHandledTask wraps an arbitrary callable Func and invokes it inside a try / catch block. Any exception thrown by the callable is captured into a TaskError and forwarded to the associated ErrorHandler; the exception is not re-thrown, so from the caller's perspective the task completes normally (silently succeeds).

Template Parameters
FuncCallable type. Must be invocable with operator()() (no arguments, return value is discarded).
Ownership
The ErrorHandler is held via std::shared_ptr, making it safe to copy or move ErrorHandledTask across thread boundaries without lifetime issues.
See also
make_error_handled_task

Definition at line 224 of file error_handler.hpp.

Constructor & Destructor Documentation

◆ ErrorHandledTask()

template<typename Func>
threadschedule::ErrorHandledTask< Func >::ErrorHandledTask ( Func && func,
std::shared_ptr< ErrorHandler > handler,
std::string description = "" )
inline

Definition at line 227 of file error_handler.hpp.

Member Function Documentation

◆ operator()()

template<typename Func>
void threadschedule::ErrorHandledTask< Func >::operator() ( )
inline

Definition at line 232 of file error_handler.hpp.


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