ThreadSchedule 3.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::task_error Struct Reference

Captured information about a task failure. More...

#include <task_error.hpp>

Public Member Functions

auto what () const -> std::string
 Return a printable error message if exception derives from std::exception.
 
void rethrow () const
 Rethrow captured exception if present.
 

Static Public Member Functions

static auto capture (std::string description={}) -> task_error
 Capture failure context for the current exception state.
 

Public Attributes

std::exception_ptr exception
 Original exception object captured from the task.
 
std::string task_description
 Optional textual description of the failing task.
 
std::thread::id std_id
 std::thread id where the failure occurred.
 
std::chrono::steady_clock::time_point timestamp
 Capture timestamp using steady_clock.
 

Detailed Description

Captured information about a task failure.

Definition at line 21 of file task_error.hpp.

Member Function Documentation

◆ capture()

static auto threadschedule::task_error::capture ( std::string  description = {}) -> task_error
inlinestatic

Capture failure context for the current exception state.

Parameters
descriptionOptional task description string.

Definition at line 37 of file task_error.hpp.

Referenced by threadschedule::advanced::error_handled_task< Func >::operator()(), threadschedule::thread_pool::post(), and threadschedule::thread_pool::submit().

◆ rethrow()

void threadschedule::task_error::rethrow ( ) const
inline

Rethrow captured exception if present.

Definition at line 70 of file task_error.hpp.

References exception.

◆ what()

auto threadschedule::task_error::what ( ) const -> std::string
inline

Return a printable error message if exception derives from std::exception.

Returns
Exception message, "Unknown exception", or "No exception".

Definition at line 48 of file task_error.hpp.

References exception.

Member Data Documentation

◆ exception

std::exception_ptr threadschedule::task_error::exception

Original exception object captured from the task.

Definition at line 24 of file task_error.hpp.

Referenced by rethrow(), and what().

◆ std_id

std::thread::id threadschedule::task_error::std_id

std::thread id where the failure occurred.

Definition at line 28 of file task_error.hpp.

◆ task_description

std::string threadschedule::task_error::task_description

Optional textual description of the failing task.

Definition at line 26 of file task_error.hpp.

◆ timestamp

std::chrono::steady_clock::time_point threadschedule::task_error::timestamp

Capture timestamp using steady_clock.

Definition at line 30 of file task_error.hpp.


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