49 std::exception_ptr exception,
52 event.severity = severity;
53 event.origin = origin ? origin : std::string{};
55 event.context = std::move(context);
58 event.message =
"unknown exception";
59 event.exceptionType =
"unknown";
64 std::rethrow_exception(exception);
65 }
catch (
const std::exception &ex) {
66 event.message = ex.what();
67 event.exceptionType =
typeid(ex).name();
71 event.message =
"non-std exception";
72 event.exceptionType =
"unknown";
Declares structured error event payloads.
Defines shared structured error codes.
constexpr const char * ExceptionError
Fallback code for exception-backed errors.
constexpr const char * ExceptionNonStd
Code used when a non-standard exception is captured.
constexpr const char * ExceptionStd
Code used when a standard exception is captured.
ErrorSeverity
Severity level for structured error events.
std::vector< std::pair< std::string, std::string > > ErrorContext
Key/value context attached to an error event.
ErrorEvent makeExceptionEvent(ErrorSeverity severity, const char *code, const char *origin, std::exception_ptr exception, ErrorContext context={})
Build a structured event from an exception pointer.
const char * severityToString(ErrorSeverity severity) noexcept
Convert an error severity to a stable lowercase label.
Structured error payload sent through diagnostics ports.