FOSSredder 0.5.0
Loading...
Searching...
No Matches
core::errors Namespace Reference

Namespaces

namespace  codes

Classes

struct  ErrorEvent
 Structured error payload sent through diagnostics ports. More...

Typedefs

using ErrorContext = std::vector<std::pair<std::string, std::string>>
 Key/value context attached to an error event.

Enumerations

enum class  ErrorSeverity { Info , Warning , Error , Critical }
 Severity level for structured error events. More...

Functions

const char * severityToString (ErrorSeverity severity) noexcept
 Convert an error severity to a stable lowercase label.
ErrorEvent makeExceptionEvent (ErrorSeverity severity, const char *code, const char *origin, std::exception_ptr exception, ErrorContext context={})
 Build a structured event from an exception pointer.
void report (core::ports::diagnostics::IErrorReporter *reporter, const ErrorEvent &event)
 Report an already constructed error event when a reporter exists.
void report (core::ports::diagnostics::IErrorReporter *reporter, ErrorSeverity severity, const char *code, const char *origin, std::string message, ErrorContext context={})
 Construct and report a structured error event.
void reportException (core::ports::diagnostics::IErrorReporter *reporter, ErrorSeverity severity, const char *origin, std::exception_ptr exception)
 Report an exception through the reporter's default exception handling.
void reportException (core::ports::diagnostics::IErrorReporter *reporter, ErrorSeverity severity, const char *code, const char *origin, std::exception_ptr exception, ErrorContext context={})
 Build and report a structured exception event.

Typedef Documentation

◆ ErrorContext

using core::errors::ErrorContext = std::vector<std::pair<std::string, std::string>>

Key/value context attached to an error event.

Definition at line 27 of file ErrorEvent.h.

Enumeration Type Documentation

◆ ErrorSeverity

enum class core::errors::ErrorSeverity
strong

Severity level for structured error events.

Enumerator
Info 
Warning 
Error 
Critical 

Definition at line 17 of file ErrorEvent.h.

Function Documentation

◆ makeExceptionEvent()

ErrorEvent core::errors::makeExceptionEvent ( ErrorSeverity severity,
const char * code,
const char * origin,
std::exception_ptr exception,
ErrorContext context = {} )
inline

Build a structured event from an exception pointer.

Parameters
severitySeverity to store on the event.
codeOptional structured error code.
originOptional origin string describing the reporting site.
exceptionException pointer to inspect.
contextAdditional event context.
Returns
Structured error event describing the exception.

Definition at line 47 of file ErrorEventFactory.h.

Here is the caller graph for this function:

◆ report() [1/2]

void core::errors::report ( core::ports::diagnostics::IErrorReporter * reporter,
const ErrorEvent & event )
inline

Report an already constructed error event when a reporter exists.

Parameters
reporterOptional reporter port.
eventEvent to report.

Definition at line 23 of file ErrorReporting.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ report() [2/2]

void core::errors::report ( core::ports::diagnostics::IErrorReporter * reporter,
ErrorSeverity severity,
const char * code,
const char * origin,
std::string message,
ErrorContext context = {} )
inline

Construct and report a structured error event.

Parameters
reporterOptional reporter port.
severitySeverity to store on the event.
codeOptional structured error code.
originOptional origin string describing the reporting site.
messageHuman-readable error message.
contextAdditional event context.

Definition at line 38 of file ErrorReporting.h.

◆ reportException() [1/2]

void core::errors::reportException ( core::ports::diagnostics::IErrorReporter * reporter,
ErrorSeverity severity,
const char * code,
const char * origin,
std::exception_ptr exception,
ErrorContext context = {} )
inline

Build and report a structured exception event.

Parameters
reporterOptional reporter port.
severitySeverity to apply to the exception event.
codeOptional structured error code.
originOptional origin string describing the reporting site.
exceptionException pointer to inspect.
contextAdditional event context.

Definition at line 74 of file ErrorReporting.h.

◆ reportException() [2/2]

void core::errors::reportException ( core::ports::diagnostics::IErrorReporter * reporter,
ErrorSeverity severity,
const char * origin,
std::exception_ptr exception )
inline

Report an exception through the reporter's default exception handling.

Parameters
reporterOptional reporter port.
severitySeverity to apply to the exception event.
originOptional origin string describing the reporting site.
exceptionException pointer to report.

Definition at line 58 of file ErrorReporting.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ severityToString()

const char * core::errors::severityToString ( ErrorSeverity severity)
inlinenoexcept

Convert an error severity to a stable lowercase label.

Parameters
severitySeverity value to convert.
Returns
String label for the severity.

Definition at line 23 of file ErrorEventFactory.h.