Class exception_base

Inheritance Relationships

Base Type

  • public std::exception

Derived Types

Class Documentation

class exception_base : public std::exception

Owned diagnostics on every compiler.

Construction helpers catch trace/format allocation failure and store bounded category/location/info without allocation. The fallback changes the exception layout; consumers must rebuild together. Allocation in caller argument expressions remains the caller’s responsibility. what()/diagnostic_summary() borrow this exception’s owned storage; retain the exception and exclude concurrent mutation while inspecting those pointers.

Subclassed by CE::Exceptions::invalid_args, CE::Exceptions::runtime_exception

Public Functions

inline explicit exception_base(std::string msg) noexcept

Take ownership of an already-created message without formatting or a trace.

Parameters:

msg – Owned message; empty yields an empty what() string. String creation before entry may throw; moving it into this exception does not allocate.

inline exception_base(std::string msg, exception_base fallback) noexcept

Own a full message and copy the supplied bounded emergency summary.

Parameters:
  • msg – Full message, normally including an Engine trace/category/location.

  • fallback – Exception carrying fixed-buffer fallback text. what() prefers a nonempty full message; diagnostic_summary() prefers the copied fallback. Call-site argument evaluation can allocate before entry.

inline exception_base(const exception_base &other) noexcept

Copy owned diagnostic text, retaining a bounded message if allocation fails.

Parameters:

other – Stable source exception. On message-copy failure, keep the source fallback or copy/truncate other.what() into the fixed buffer. Copying does not propagate allocation failure.

exception_base(exception_base &&other) noexcept = default

Move the owned message and copy the bounded summary.

Parameters:

other – Source exception; its subsequent what() remains valid but its full message content is unspecified.

~exception_base() override

Release owned text through a virtual, nonthrowing base destructor.

inline const char *what() const noexcept override

Declaration: [[nodiscard]]

Returns:

Borrowed NUL-terminated full message, or the bounded fallback when the full string is empty. Valid until this exception is mutated or destroyed; no allocation or logging occurs.

inline const char *diagnostic_summary() const noexcept

Declaration: [[nodiscard]]

Returns:

Borrowed bounded category/location/info when present, otherwise what(). Emergency reporting uses this to prioritize the cause over an allocating trace prefix; no formatting, allocation or output occurs.

Public Static Functions

static inline exception_base fallback(const char *category, const char *location, uint32_t line, const char *info) noexcept

Declaration: [[nodiscard]]

Build bounded owned diagnostics without allocation or stack capture.

Parameters:
  • category – NUL-terminated category, or null for an unknown marker.

  • location – NUL-terminated source location, or null for an unknown marker.

  • line – Source line number, formatted as unsigned decimal.

  • info – Optional NUL-terminated detail; null appends no detail.

Returns:

Owned exception with at most 511 bytes plus a terminating NUL; later text is truncated when the fixed buffer fills. Pointers are read during the call, not retained. No logging or native callback is invoked.