rogue::GeneralError

Python binding

This C++ class is also exported into Python as rogue.GeneralError.

Python API page: - rogue.GeneralError

For conceptual usage, see:

class GeneralError : public std::exception
[header]

Generic Rogue exception type.

Used for runtime errors that are not represented by a more specific exception class. Error messages are formatted as source: message and can be propagated to Python via setup_python() and translate().

Public Functions

GeneralError(std::string src, std::string text)
[header] [impl]

Constructs an error from source and message text.

This constructor is a low-level C++ allocation path. Prefer create() when consistent factory semantics are desired.

Parameters:
  • src – Source/function context string.

  • text – Error message body.

char const *what() const
[header] [impl]

Returns exception text for standard exception handling.

Returns:

NUL-terminated message string.

Public Static Functions

static GeneralError create(std::string src, const char *fmt, ...)
[header] [impl]

Creates a formatted error instance.

This static factory provides a consistent construction path for this class.

Parameters:
  • src – Source/function context string.

  • fmtprintf-style format string for the message body.

Returns:

Constructed GeneralError.

static void setup_python()
[header] [impl]

Registers Python exception translation for GeneralError.

static void translate(GeneralError const &e)
[header] [impl]

Translates GeneralError into a Python exception.

Parameters:

e – Caught exception instance.