Essentials
error.h
Framework errors, assertions, stack traces, and exception translation.
#include <mc/error.h>Catch CError for framework failures. Translated standard or user exceptions retain a std::exception_ptr cause.
cAssert remains active in Release builds. MC_ERROR_STACK_TRACES defaults to 1 in all build configurations, independently of NDEBUG and debug symbols. Keep the setting consistent across the application and its libraries; the SDK enables capture.
The SDK's Release libraries report available function symbols and addresses without framework source code or file-and-line information. Your application's debug information can add source locations for its own frames; optimization and symbol stripping can reduce the detail available.
Jump to a declaration · 29
CError
class CError : public std::exceptionMethods
CError
Captures an error message and, when enabled, the construction-time stack trace. Copying preserves the original diagnostic rather than recording a new failure site.
~CError
virtual ~CError() noexcept;
what
virtual const char* what() const noexcept;
Returns the null-terminated diagnostic text as required by std::exception. The pointer is borrowed from this error object.
str
const cstr& str() const;
Returns the diagnostic message as a borrowed cstr reference.
stackTrace
cstr stackTrace() const noexcept;
Formats the trace captured when the error was created, using available symbols and addresses. Works without debug symbols; source file names and line numbers are included only when matching debug information is available. Returns an empty string if no trace was captured or trace formatting fails.
CExternalError
class CExternalError : public CErrorMethods
CExternalError
CExternalError(const cstr& message, std::exception_ptr cause);
Creates a framework error while retaining the original exception pointer. The retained cause can be inspected or rethrown by the caller.
cause
std::exception_ptr cause() const noexcept;
Returns the original exception for a translated failure, or an empty pointer when there is no retained cause.
COutOfRangeError
class COutOfRangeError : public CExternalErrorTypes, constants & data
using CExternalError::CExternalError;
CLengthError
class CLengthError : public CExternalErrorTypes, constants & data
using CExternalError::CExternalError;
CAllocationError
class CAllocationError : public CErrorMethods
CAllocationError
explicit CAllocationError(std::exception_ptr cause) noexcept;
Represents an allocation failure without allocating diagnostic storage during construction. Retains the original exception pointer.
what
const char* what() const noexcept override;
cause
std::exception_ptr cause() const noexcept;
Returns the retained allocation exception, or an empty pointer when none was supplied.
Free functions & types
Functions
cRethrowError
inline void cRethrowError();
Call while handling an exception. Preserves an existing CError; translates other exceptions and retains their cause.
cContainerCall
template<class F> constexpr decltype(auto) cContainerCall(F&& operation) noexcept(noexcept(std::forward<F>(operation)()));
Runs a callable through the Catalyst exception boundary, preserving references and move-only return values.
cContainerDefault
template<class T> constexpr T cContainerDefault() noexcept(std::is_nothrow_default_constructible_v<T>);
Constructs a default policy or allocator through the Catalyst exception boundary.
cError
template<class T = bool> inline T cError(const cstr& message);
Always throws CError with the supplied message. The template return type lets it appear in an expression whose other branches return that type.
cUnreachable
template<class T = bool> inline T cUnreachable();
Throws a framework error to report an unreachable code path. The return-type template supports expression contexts.
operator<<
inline std::ostream& operator<<(std::ostream& ostr, const CError& e);
cAssert
inline void cAssert(bool condition, const cstr& message = "");
Throws CError when the condition is false. Unlike the standard assert macro, this check remains enabled in Release builds.
CParseError
class CParseError : public CErrorTypes, constants & data
uint32_t line;
Methods
CParseError
CParseError(const cstr& message, uint32_t line);
Creates a parser error with a line number and diagnostic message. The line identifies the source location reported by the parser.
Free functions & types
Types, constants & data
#define MC_ERROR_STACK_TRACES