36 #define __func__ __FUNCTION__
40 #define VALIDATE(cond, message) \
43 throw_wml_exception(#cond, __FILE__, __LINE__, __func__, message); \
47 #define VALIDATE_WML_CHILD(cfg, key, message) \
48 ([](auto c, auto k) { \
49 if(auto child = c.optional_child(k)) { return *child; } \
50 throw_wml_exception( "Missing [" key "]", __FILE__, __LINE__, __func__, message); \
53 #define VALIDATE_WITH_DEV_MESSAGE(cond, message, dev_message) \
56 throw_wml_exception(#cond \
65 #define FAIL(message) \
67 throw_wml_exception(nullptr, __FILE__, __LINE__, __func__, message); \
70 #define FAIL_WITH_DEV_MESSAGE(message, dev_message) \
72 throw_wml_exception(nullptr \
94 ,
const char *
function
95 ,
const std::string& message
96 ,
const std::string& dev_message =
"");
149 const std::string& section
150 ,
const std::string& key
151 ,
const std::string& primary_key =
""
152 ,
const std::string& primary_value =
"");
164 const std::string& section
165 ,
const std::string&
tag);
Base class for exceptions that want to be thrown 'through' lua.
void store() const noexcept
Stores a copy the current exception to be rethrown.
#define IMPLEMENT_LUA_JAILBREAK_EXCEPTION(type)
Helper macro for classes deriving from lua_jailbreak_exception.
void line(int from_x, int from_y, int to_x, int to_y)
Draw a line.
std::string tag(const std::string &tag_name, Args &&... contents)
Helper class, don't construct this directly.
wml_exception(const std::string &user_msg, const std::string &dev_msg)
void show() const
Shows the error in a dialog.
std::string dev_message
The message for developers telling which problem was triggered, this shouldn't be translated.
std::string user_message
The message for the user explaining what went wrong.
~wml_exception() noexcept
std::string missing_mandatory_wml_key(const std::string §ion, const std::string &key, const std::string &primary_key="", const std::string &primary_value="")
Returns a standard message for a missing wml key (attribute).
std::string missing_mandatory_wml_tag(const std::string §ion, const std::string &tag)
Returns a standard message for a missing wml child (tag).
void throw_wml_exception(const char *cond, const char *file, int line, const char *function, const std::string &message, const std::string &dev_message="")
Helper function, don't call this directly.