static void print_output(const std::string & message,bool flag_exception = false ){ #ifndef VALIDATION_ERRORS_LOG if(flag_exception){ throw wml_exception("Validation error occured",message); }else{ ERR_VL << message; } #else // dirty hack to avoid "unused" error in case of compiling with definition on flag_exception = true; if (flag_exception){ ERR_VL << message;} #endif }
void throw_wml_exception( const char* cond , const char* file , const int line , const char *function , const std::string& message , const std::string& dev_message) { std::ostringstream sstr; if(cond) { sstr << "Condition '" << cond << "' failed at "; } else { sstr << "Unconditional failure at "; } sstr << file << ":" << line << " in function '" << function << "'."; if(!dev_message.empty()) { sstr << " Extra development information: " << dev_message; } throw wml_exception(message, sstr.str()); }
/** Helper function, don't call this directly. */ inline void wml_exception(const char* cond, const char* file, const int line, const char* function, const char* message) { wml_exception(cond, file, line, function, t_string(message)); }