mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 19:12:57 +00:00
Rename twml_exception -> wml_exception
This commit is contained in:
parent
e555ff9f43
commit
a1967ec16a
@ -1067,7 +1067,7 @@ bool addons_manager_ui(CVideo& v, const std::string& remote_address)
|
||||
|
||||
gui2::show_error_message(v,
|
||||
vgettext("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(v);
|
||||
} catch(const addons_client::user_exit&) {
|
||||
LOG_AC << "initial connection canceled by user\n";
|
||||
@ -1277,7 +1277,7 @@ bool ad_hoc_addon_fetch_session(CVideo& v, const std::vector<std::string>& addon
|
||||
|
||||
gui2::show_error_message(v,
|
||||
vgettext("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(v);
|
||||
} catch(const addons_client::user_exit&) {
|
||||
LOG_AC << "initial connection canceled by user\n";
|
||||
|
@ -179,7 +179,7 @@ EXIT_STATUS editor_controller::main_loop()
|
||||
} catch (editor_exception& e) {
|
||||
gui2::show_transient_message(gui().video(), _("Fatal error"), e.what());
|
||||
return EXIT_ERROR;
|
||||
} catch (twml_exception& e) {
|
||||
} catch (wml_exception& e) {
|
||||
e.show(gui().video());
|
||||
}
|
||||
return quit_mode_;
|
||||
@ -194,7 +194,7 @@ void editor_controller::do_screenshot(const std::string& screenshot_filename /*
|
||||
if (!gui().screenshot(screenshot_filename,true)) {
|
||||
ERR_ED << "Screenshot creation failed!\n";
|
||||
}
|
||||
} catch (twml_exception& e) {
|
||||
} catch (wml_exception& e) {
|
||||
e.show(gui().video());
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ editor_map editor_map::from_string(const config& terrain_cfg, const std::string&
|
||||
return editor_map(terrain_cfg, data);
|
||||
} catch (incorrect_map_format_error& e) {
|
||||
throw wrap_exc("format", e.message, "");
|
||||
} catch (twml_exception& e) {
|
||||
} catch (wml_exception& e) {
|
||||
throw wrap_exc("wml", e.user_message, "");
|
||||
} catch (config::error& e) {
|
||||
throw wrap_exc("config", e.message, "");
|
||||
|
@ -572,7 +572,7 @@ WML_HANDLER_FUNCTION(replace_map,, cfg)
|
||||
const std::string log_map_name = cfg["map"].empty() ? cfg["file"] : std::string("from inline data");
|
||||
lg::wml_error() << "replace_map: Unable to load map " << log_map_name << std::endl;
|
||||
return;
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(resources::screen->video());
|
||||
return;
|
||||
}
|
||||
@ -834,7 +834,7 @@ WML_HANDLER_FUNCTION(terrain_mask,, cfg)
|
||||
} catch(incorrect_map_format_error&) {
|
||||
ERR_NG << "terrain mask is in the incorrect format, and couldn't be applied" << std::endl;
|
||||
return;
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(resources::screen->video());
|
||||
return;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void scenario::set_metadata()
|
||||
data_["description"] = _("Map could not be loaded: ") + e.message;
|
||||
|
||||
ERR_CF << "map could not be loaded: " << e.message << '\n';
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
data_["description"] = _("Map could not be loaded.");
|
||||
|
||||
ERR_CF << "map could not be loaded: " << e.dev_message << '\n';
|
||||
@ -1051,7 +1051,7 @@ void create_engine::init_all_levels()
|
||||
e.message;
|
||||
|
||||
ERR_CF << "map could not be loaded: " << e.message << '\n';
|
||||
} catch (twml_exception&) {
|
||||
} catch (wml_exception&) {
|
||||
add_map = false;
|
||||
dep_index_offset++;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ void gamebrowser::populate_game_item_map_info(gamebrowser::game_item & item, con
|
||||
} catch (incorrect_map_format_error &e) {
|
||||
ERR_CF << "illegal map: " << e.message << '\n';
|
||||
verified = false;
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
ERR_CF << "map could not be loaded: " << e.dev_message << '\n';
|
||||
verified = false;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ LEVEL_RESULT campaign_controller::play_game()
|
||||
} catch(config::error& e) {
|
||||
gui2::show_error_message(video_, _("Error while reading the WML: ") + e.message);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video_);
|
||||
return LEVEL_RESULT::QUIT;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ bool enter_create_mode(CVideo& video, const config& game_config, saved_game& sta
|
||||
|
||||
try {
|
||||
dlg.show(video);
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video);
|
||||
return false;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "util.hpp" // for lexical_cast_default
|
||||
#include "video.hpp" // for CVideo
|
||||
#include "wesnothd_connection_error.hpp"
|
||||
#include "wml_exception.hpp" // for twml_exception
|
||||
#include "wml_exception.hpp" // for wml_exception
|
||||
|
||||
#include <algorithm> // for copy, max, min, stable_sort
|
||||
#include <boost/optional.hpp> // for optional
|
||||
@ -531,7 +531,7 @@ int game_launcher::unit_test()
|
||||
if (!(res == LEVEL_RESULT::VICTORY) || lg::broke_strict()) {
|
||||
return 1;
|
||||
}
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
std::cerr << "Caught WML Exception:" << e.dev_message << std::endl;
|
||||
return 1;
|
||||
}
|
||||
@ -558,7 +558,7 @@ int game_launcher::unit_test()
|
||||
std::cerr << "Observed failure on replay" << std::endl;
|
||||
return 4;
|
||||
}
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
std::cerr << "WML Exception while playing replay: " << e.dev_message << std::endl;
|
||||
return 4; //failed with an error during the replay
|
||||
}
|
||||
@ -652,7 +652,7 @@ bool game_launcher::load_game()
|
||||
gui2::show_error_message(video(), _("The file you have tried to load is corrupt: '") + e.message + '\'');
|
||||
}
|
||||
return false;
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
return false;
|
||||
} catch(filesystem::io_exception& e) {
|
||||
@ -876,7 +876,7 @@ bool game_launcher::play_multiplayer(mp_selection res)
|
||||
} catch (savegame::load_game_exception & e) {
|
||||
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
|
||||
//this will make it so next time through the title screen loop, this game is loaded
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
} catch (game::error & e) {
|
||||
std::cerr << "caught game::error...\n";
|
||||
@ -965,7 +965,7 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
||||
} catch (savegame::load_game_exception &e) {
|
||||
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
|
||||
//this will make it so next time through the title screen loop, this game is loaded
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
} catch(mapgen_exception& e) {
|
||||
gui2::show_error_message(video(), _("Map generator error: ") + e.message);
|
||||
@ -981,7 +981,7 @@ void game_launcher::play_replay()
|
||||
} catch (savegame::load_game_exception &e) {
|
||||
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
|
||||
//this will make it so next time through the title screen loop, this game is loaded
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
e.show(video());
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ game_info::game_info(const config& game, const config& game_config, const std::v
|
||||
} catch(incorrect_map_format_error& e) {
|
||||
ERR_CF << "illegal map: " << e.message << std::endl;
|
||||
verified = false;
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
ERR_CF << "map could not be loaded: " << e.dev_message << '\n';
|
||||
verified = false;
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ void twindow::layout()
|
||||
<< maximum_width << ',' << maximum_height << " screen size "
|
||||
<< settings::screen_width << ',' << settings::screen_height << '.';
|
||||
|
||||
throw twml_exception(_("Failed to show a dialog, "
|
||||
throw wml_exception(_("Failed to show a dialog, "
|
||||
"which doesn't fit on the screen."),
|
||||
sstr.str());
|
||||
}
|
||||
@ -1074,7 +1074,7 @@ void twindow::layout()
|
||||
<< settings::screen_width << ',' << settings::screen_height
|
||||
<< '.';
|
||||
|
||||
throw twml_exception(_("Failed to show a dialog, "
|
||||
throw wml_exception(_("Failed to show a dialog, "
|
||||
"which doesn't fit on the screen."),
|
||||
sstr.str());
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ static std::string at(const std::string & file, int line){
|
||||
static void print_output(const std::string & message,bool flag_exception = false ){
|
||||
#ifndef VALIDATION_ERRORS_LOG
|
||||
if(flag_exception){
|
||||
throw twml_exception("Validation error occured",message);
|
||||
throw wml_exception("Validation error occured",message);
|
||||
}else{
|
||||
ERR_VL << message;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ namespace {
|
||||
exception = "gui2::tlayout_exception_width_resize_failed";
|
||||
} catch(gui2::tlayout_exception_height_resize_failed&) {
|
||||
exception = "gui2::tlayout_exception_height_resize_failed";
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
exception = e.dev_message;
|
||||
} catch(std::exception& e) {
|
||||
exception = e.what();
|
||||
@ -240,7 +240,7 @@ namespace {
|
||||
exception = "gui2::tlayout_exception_width_resize_failed";
|
||||
} catch(gui2::tlayout_exception_height_resize_failed&) {
|
||||
exception = "gui2::tlayout_exception_height_resize_failed";
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
exception = e.dev_message;
|
||||
} catch(std::exception& e) {
|
||||
exception = e.what();
|
||||
@ -287,7 +287,7 @@ namespace {
|
||||
exception = "gui2::tlayout_exception_width_resize_failed";
|
||||
} catch(gui2::tlayout_exception_height_resize_failed&) {
|
||||
exception = "gui2::tlayout_exception_height_resize_failed";
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
exception = e.dev_message;
|
||||
} catch(std::exception& e) {
|
||||
exception = e.what();
|
||||
@ -512,7 +512,7 @@ BOOST_AUTO_TEST_CASE(test_make_test_fake)
|
||||
try {
|
||||
gui2::tmessage dlg("title", "message", true, false);
|
||||
dlg.show(video, 1);
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
BOOST_CHECK(e.user_message == _("Failed to show a dialog, "
|
||||
"which doesn't fit on the screen."));
|
||||
return;
|
||||
|
@ -69,7 +69,7 @@
|
||||
*
|
||||
* It is recommended to use MAKE_ENUM types with the built-in versions of
|
||||
* lexical_cast or lexical_cast_default provided by Wesnoth (see util.hpp).
|
||||
* However, if you do <b>not</b> want twml_exception to be thrown under any
|
||||
* However, if you do <b>not</b> want wml_exception to be thrown under any
|
||||
* circumstances, use the string_to_enumname functions instead.
|
||||
*
|
||||
* See src/tests/test_make_enum.cpp for example code.
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include "video.hpp" // for CVideo
|
||||
#include "wesconfig.h" // for PACKAGE
|
||||
#include "widgets/button.hpp" // for button
|
||||
#include "wml_exception.hpp" // for twml_exception
|
||||
#include "wml_exception.hpp" // for wml_exception
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "log_windows.hpp"
|
||||
@ -1074,7 +1074,7 @@ int main(int argc, char** argv)
|
||||
std::cerr << "caught return_to_play_side_exception, please report this bug (quitting)\n";
|
||||
} catch(quit_game_exception&) {
|
||||
std::cerr << "caught quit_game_exception (quitting)\n";
|
||||
} catch(twml_exception& e) {
|
||||
} catch(wml_exception& e) {
|
||||
std::cerr << "WML exception:\nUser message: "
|
||||
<< e.user_message << "\nDev message: " << e.dev_message << '\n';
|
||||
error_exit(1);
|
||||
|
@ -30,7 +30,7 @@
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define WRN_NG LOG_STREAM(warn, log_engine)
|
||||
|
||||
void wml_exception(
|
||||
void throw_wml_exception(
|
||||
const char* cond
|
||||
, const char* file
|
||||
, const int line
|
||||
@ -51,10 +51,10 @@ void wml_exception(
|
||||
sstr << " Extra development information: " << dev_message;
|
||||
}
|
||||
|
||||
throw twml_exception(message, sstr.str());
|
||||
throw wml_exception(message, sstr.str());
|
||||
}
|
||||
|
||||
void twml_exception::show(CVideo &video)
|
||||
void wml_exception::show(CVideo &video)
|
||||
{
|
||||
std::ostringstream sstr;
|
||||
|
||||
|
@ -43,14 +43,14 @@ class CVideo;
|
||||
#define VALIDATE(cond, message) \
|
||||
do { \
|
||||
if(!(cond)) { \
|
||||
wml_exception(#cond, __FILE__, __LINE__, __func__, message); \
|
||||
throw_wml_exception(#cond, __FILE__, __LINE__, __func__, message); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define VALIDATE_WITH_DEV_MESSAGE(cond, message, dev_message) \
|
||||
do { \
|
||||
if(!(cond)) { \
|
||||
wml_exception(#cond \
|
||||
throw_wml_exception(#cond \
|
||||
, __FILE__ \
|
||||
, __LINE__ \
|
||||
, __func__ \
|
||||
@ -61,12 +61,12 @@ class CVideo;
|
||||
|
||||
#define FAIL(message) \
|
||||
do { \
|
||||
wml_exception(nullptr, __FILE__, __LINE__, __func__, message); \
|
||||
throw_wml_exception(nullptr, __FILE__, __LINE__, __func__, message); \
|
||||
} while(0)
|
||||
|
||||
#define FAIL_WITH_DEV_MESSAGE(message, dev_message) \
|
||||
do { \
|
||||
wml_exception(nullptr \
|
||||
throw_wml_exception(nullptr \
|
||||
, __FILE__ \
|
||||
, __LINE__ \
|
||||
, __func__ \
|
||||
@ -83,7 +83,7 @@ class CVideo;
|
||||
* @param function The function in which the test failed.
|
||||
* @param message The translated message to show the user.
|
||||
*/
|
||||
NORETURN void wml_exception(
|
||||
NORETURN void throw_wml_exception(
|
||||
const char* cond
|
||||
, const char* file
|
||||
, int line
|
||||
@ -92,16 +92,16 @@ NORETURN void wml_exception(
|
||||
, const std::string& dev_message = "");
|
||||
|
||||
/** Helper class, don't construct this directly. */
|
||||
struct twml_exception
|
||||
struct wml_exception
|
||||
: public lua_jailbreak_exception
|
||||
{
|
||||
twml_exception(const std::string& user_msg, const std::string& dev_msg)
|
||||
wml_exception(const std::string& user_msg, const std::string& dev_msg)
|
||||
: user_message(user_msg)
|
||||
, dev_message(dev_msg)
|
||||
{
|
||||
}
|
||||
|
||||
~twml_exception() throw() {}
|
||||
~wml_exception() throw() {}
|
||||
|
||||
/**
|
||||
* The message for the user explaining what went wrong. This message can
|
||||
@ -123,7 +123,7 @@ struct twml_exception
|
||||
*/
|
||||
void show(CVideo& video);
|
||||
private:
|
||||
IMPLEMENT_LUA_JAILBREAK_EXCEPTION(twml_exception)
|
||||
IMPLEMENT_LUA_JAILBREAK_EXCEPTION(wml_exception)
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user