Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::default_error_handler Class Reference

Default error handler implementation. More...

#include <error_handler.h>

Inheritance diagram for kcenon::thread::default_error_handler:
Inheritance graph
Collaboration diagram for kcenon::thread::default_error_handler:
Collaboration graph

Public Member Functions

void handle_error (const std::string &context, const std::string &error) override
 Handle an error.
 
void set_error_callback (error_callback callback) override
 Set a callback for error handling.
 
- Public Member Functions inherited from kcenon::thread::error_handler
virtual ~error_handler ()=default
 

Private Attributes

error_callback callback_
 

Additional Inherited Members

- Public Types inherited from kcenon::thread::error_handler
using error_callback
 

Detailed Description

Default error handler implementation.

Uses the common_system ILogger interface if available and calls registered callbacks.

Note
Issue #261: Migrated to use common_system's GlobalLoggerRegistry.

Definition at line 56 of file error_handler.h.

Member Function Documentation

◆ handle_error()

void kcenon::thread::default_error_handler::handle_error ( const std::string & context,
const std::string & error )
inlineoverridevirtual

Handle an error.

Parameters
contextContext where the error occurred
errorError message

Implements kcenon::thread::error_handler.

Definition at line 61 of file error_handler.h.

62 {
63 // Log the error using GlobalLoggerRegistry
64 auto logger = common::interfaces::GlobalLoggerRegistry::instance().get_default_logger();
65 if (logger) {
66 logger->log(common::interfaces::log_level::error, context + ": " + error);
67 }
68
69 // Call the callback if registered
70 if (callback_) {
71 callback_(context, error);
72 }
73 }
@ error
Error events that might still allow continuation.

References callback_.

◆ set_error_callback()

void kcenon::thread::default_error_handler::set_error_callback ( error_callback callback)
inlineoverridevirtual

Set a callback for error handling.

Parameters
callbackCallback function to be called on errors

Implements kcenon::thread::error_handler.

Definition at line 75 of file error_handler.h.

75 {
77 }
@ callback
Call user callback for custom decision.

References kcenon::thread::callback, and callback_.

Member Data Documentation

◆ callback_

error_callback kcenon::thread::default_error_handler::callback_
private

Definition at line 58 of file error_handler.h.

Referenced by handle_error(), and set_error_callback().


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