Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::exception_mapper Class Referenceexport

Maps standard exception types to appropriate error codes. More...

#include <utilities.h>

Collaboration diagram for kcenon::common::exception_mapper:
Collaboration graph

Static Public Member Functions

static error_info map_unknown_exception (const std::string &module="")
 Map unknown exception (catch-all)
 
static error_info map_generic_exception (const std::exception &e, const std::string &module="")
 Map generic exception.
 
static error_info map_unknown_exception (const std::string &module="")
 
static error_info map_generic_exception (const std::exception &e, const std::string &module="")
 

Detailed Description

Maps standard exception types to appropriate error codes.

Provides automatic error code assignment based on exception type, enabling more precise error handling without manual code specification.

Note: This class is kept for API compatibility but is no longer used internally. The try_catch functions now use multiple catch blocks for better performance.

Definition at line 122 of file utilities.cppm.

Member Function Documentation

◆ map_generic_exception() [1/2]

static error_info kcenon::common::exception_mapper::map_generic_exception ( const std::exception & e,
const std::string & module = "" )
inlinestatic

Map generic exception.

Parameters
eException object
moduleModule name
Returns
error_info

Definition at line 146 of file utilities.h.

146 {
147 return error_info{error_codes::INTERNAL_ERROR, e.what(), module, "std::exception"};
148 }
constexpr int INTERNAL_ERROR
Definition compat.h:42

References kcenon::common::error_codes::INTERNAL_ERROR.

Referenced by kcenon::common::try_catch(), and kcenon::common::try_catch_void().

Here is the caller graph for this function:

◆ map_generic_exception() [2/2]

static error_info kcenon::common::exception_mapper::map_generic_exception ( const std::exception & e,
const std::string & module = "" )
inlinestaticexport

Definition at line 129 of file utilities.cppm.

129 {
130 return error_info{error_codes::INTERNAL_ERROR, e.what(), module, "std::exception"};
131 }

References kcenon::common::error_codes::INTERNAL_ERROR.

◆ map_unknown_exception() [1/2]

static error_info kcenon::common::exception_mapper::map_unknown_exception ( const std::string & module = "")
inlinestatic

Map unknown exception (catch-all)

Parameters
moduleModule name
Returns
error_info for unknown exception

Definition at line 135 of file utilities.h.

135 {
136 return error_info{error_codes::INTERNAL_ERROR, "Unknown exception caught", module,
137 "Non-standard exception (not derived from std::exception)"};
138 }

References kcenon::common::error_codes::INTERNAL_ERROR.

Referenced by kcenon::common::try_catch(), and kcenon::common::try_catch_void().

Here is the caller graph for this function:

◆ map_unknown_exception() [2/2]

static error_info kcenon::common::exception_mapper::map_unknown_exception ( const std::string & module = "")
inlinestaticexport

Definition at line 124 of file utilities.cppm.

124 {
125 return error_info{error_codes::INTERNAL_ERROR, "Unknown exception caught", module,
126 "Non-standard exception (not derived from std::exception)"};
127 }

References kcenon::common::error_codes::INTERNAL_ERROR.


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