Catch all exceptions (where possible) as const references

A few catch blocks modify something in their exceptions, so those are kept non-const.

(cherry-picked from commit 2bf4d68c87)
This commit is contained in:
Charles Dang 2018-05-13 15:47:29 +11:00
parent cefbad9b1e
commit d9fb6c0bf5
101 changed files with 323 additions and 323 deletions

View file

@ -1202,14 +1202,14 @@ bool attack::perform_hit(bool attacker_turn, statistics::attack_context& stats)
if(hits) {
try {
fire_event(attacker_turn ? "attacker_hits" : "defender_hits");
} catch(attack_end_exception) {
} catch(const attack_end_exception&) {
refresh_bc();
return false;
}
} else {
try {
fire_event(attacker_turn ? "attacker_misses" : "defender_misses");
} catch(attack_end_exception) {
} catch(const attack_end_exception&) {
refresh_bc();
return false;
}
@ -1434,7 +1434,7 @@ void attack::perform()
try {
fire_event("attack");
} catch(attack_end_exception) {
} catch(const attack_end_exception&) {
return;
}

View file

@ -298,11 +298,11 @@ void undo_list::read(const config & cfg)
if ( action ) {
undos_.push_back(action);
}
} catch (bad_lexical_cast &) {
} catch (const bad_lexical_cast &) {
ERR_NG << "Error when parsing undo list from config: bad lexical cast." << std::endl;
ERR_NG << "config was: " << child.debug() << std::endl;
ERR_NG << "Skipping this undo action..." << std::endl;
} catch (config::error& e) {
} catch (const config::error& e) {
ERR_NG << "Error when parsing undo list from config: " << e.what() << std::endl;
ERR_NG << "config was: " << child.debug() << std::endl;
ERR_NG << "Skipping this undo action..." << std::endl;
@ -313,11 +313,11 @@ void undo_list::read(const config & cfg)
for (const config & child : cfg.child_range("redo")) {
try {
redos_.push_back(new config(child));
} catch (bad_lexical_cast &) {
} catch (const bad_lexical_cast &) {
ERR_NG << "Error when parsing redo list from config: bad lexical cast." << std::endl;
ERR_NG << "config was: " << child.debug() << std::endl;
ERR_NG << "Skipping this redo action..." << std::endl;
} catch (config::error& e) {
} catch (const config::error& e) {
ERR_NG << "Error when parsing redo list from config: " << e.what() << std::endl;
ERR_NG << "config was: " << child.debug() << std::endl;
ERR_NG << "Skipping this redo action..." << std::endl;

View file

@ -149,7 +149,7 @@ bool addons_client::upload_addon(const std::string& id, std::string& response_me
config addon_data;
try {
archive_addon(id, addon_data);
} catch(utf8::invalid_utf8_exception&){
} catch(const utf8::invalid_utf8_exception&){
this->last_error_ =
VGETTEXT("The add-on <i>$addon_title</i> has a file or directory "
"containing invalid characters and cannot be published.", i18n_symbols);

View file

@ -95,7 +95,7 @@ bool addons_manager_ui(const std::string& remote_address)
gui2::show_error_message(
VGETTEXT("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
} catch(const addons_client::user_exit&) {
LOG_AC << "initial connection canceled by user\n";
@ -306,7 +306,7 @@ bool ad_hoc_addon_fetch_session(const std::vector<std::string>& addon_ids)
gui2::show_error_message(
VGETTEXT("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
} catch(const addons_client::user_exit&) {
LOG_AC << "initial connection canceled by user\n";

View file

@ -96,7 +96,7 @@ void action_result::execute()
if (is_success()){
try {
do_execute();
} catch (return_to_play_side_exception&) {
} catch (const return_to_play_side_exception&) {
if (!is_ok()) { DBG_AI_ACTIONS << "Return value of AI ACTION was not checked." << std::endl; } //Demotes to DBG "unchecked result" warning
throw;
}

View file

@ -160,7 +160,7 @@ static component *find_component(component *root, const std::string &path, path_
} else {
try {
pe.position = std::stoi(position);
} catch (std::invalid_argument&) {
} catch (const std::invalid_argument&) {
pe.position = -2;
}
}

View file

@ -334,7 +334,7 @@ void lua_goal::add_targets(std::back_insert_iterator< std::vector< target >> tar
{
*target_list = tg;
}
} catch(bad_enum_cast& e) {
} catch(const bad_enum_cast& e) {
ERR_AI_GOAL << "A Lua goal returned a target of an unknown type (\"" << e.value() << "\"; unfortunately, the engine cannot recover from this error. As a result, all targets returned by the goal have been lost.\n";
}

View file

@ -172,7 +172,7 @@ bool configuration::get_side_config_from_file(const std::string& file, config& c
filesystem::scoped_istream stream = preprocess_file(filesystem::get_wml_location(file));
read(cfg, *stream);
LOG_AI_CONFIGURATION << "Reading AI configuration from file '" << file << "'" << std::endl;
} catch(config::error &) {
} catch(const config::error &) {
ERR_AI_CONFIGURATION << "Error while reading AI configuration from file '" << file << "'" << std::endl;
return false;
}

View file

@ -86,7 +86,7 @@ ca_ptr formula_ai::load_candidate_action_from_config(const config& rc_action)
} else {
ERR_AI << "Unknown candidate action type: " << type << std::endl;
}
} catch(formula_error& e) {
} catch(const formula_error& e) {
handle_exception(e, "Error while registering candidate action '" + name + "'");
}
return new_ca;
@ -144,7 +144,7 @@ formula_ptr formula_ai::create_optional_formula(const std::string& formula_strin
try{
return formula::create_optional_formula(formula_string, &function_table_);
}
catch(formula_error& e) {
catch(const formula_error& e) {
handle_exception(e);
return wfl::formula_ptr();
}
@ -656,7 +656,7 @@ void formula_ai::on_create(){
create_optional_formula(func["precondition"]),
args);
}
catch(formula_error& e) {
catch(const formula_error& e) {
handle_exception(e, "Error while registering function '" + name + "'");
}
}
@ -752,7 +752,7 @@ config formula_ai::to_config() const
{
try {
str = i->second.serialize_to_string();
} catch (type_error&) {
} catch(const type_error&) {
WRN_AI << "variable ["<< i->first <<"] is not serializable - it will not be persisted across savegames"<<std::endl;
continue;
}

View file

@ -45,10 +45,10 @@ int base_candidate_action::execute_formula(const const_formula_ptr& formula,
int res = 0;
try {
res = (formula::evaluate(formula, callable)).as_int();
} catch(formula_error& e) {
} catch(const formula_error& e) {
ai->handle_exception(e);
res = 0;
} catch(type_error& e) {
} catch(const type_error& e) {
res = 0;
ERR_AI << "formula type error while evaluating candidate action: " << e.message << std::endl;
}
@ -115,7 +115,7 @@ void move_candidate_action::evaluate(ai::formula_ai* ai, unit_map& units)
else
filtered_units=my_units;
}
catch(formula_error& e) {
catch(const formula_error& e) {
ai->handle_exception(e, "Error while executing filter formula for '" + get_name() + "' Candidate Action");
return;
}
@ -185,7 +185,7 @@ void attack_candidate_action::evaluate(ai::formula_ai* ai, unit_map& units)
else
filtered_enemy_units = enemy_units;
}
catch(formula_error& e) {
catch(const formula_error& e) {
ai->handle_exception(e, "Error while executing filter formula for '" + get_name() + "' Candidate Action");
return;
}
@ -194,7 +194,7 @@ void attack_candidate_action::evaluate(ai::formula_ai* ai, unit_map& units)
if( !(filtered_enemy_units.num_elements() && filtered_my_units.num_elements() ) )
return;
}
catch(type_error& e) {
catch(const type_error& e) {
ERR_AI << "Error while executing filter formulas for '" + get_name() + "' Candidate Action: " << e.message << std::endl;
return;
}

View file

@ -78,7 +78,7 @@ bool stage_unit_formulas::do_play_stage()
fai_.handle_exception( e, "Unit priority formula error for unit: '" + i->type_id() + "' standing at (" + std::to_string(i->get_location().wml_x()) + "," + std::to_string(i->get_location().wml_y()) + ")");
priority = 0;
} catch(wfl::type_error& e) {
} catch(const wfl::type_error& e) {
priority = 0;
ERR_AI << "formula type error while evaluating unit priority formula " << e.message << std::endl;
}

View file

@ -589,14 +589,14 @@ void server::handle_request_campaign_list(const server::request& req)
try {
before += req.cfg["before"].to_time_t();
before_flag = true;
} catch(bad_lexical_cast) {}
} catch(const bad_lexical_cast&) {}
bool after_flag = false;
time_t after = epoch;
try {
after += req.cfg["after"].to_time_t();
after_flag = true;
} catch(bad_lexical_cast) {}
} catch(const bad_lexical_cast&) {}
const std::string& name = req.cfg["name"];
const std::string& lang = req.cfg["language"];
@ -1009,13 +1009,13 @@ int main()
const std::string cfg_path = filesystem::normalize_path("server.cfg");
campaignd::server(cfg_path).run();
} catch(config::error& /*e*/) {
} catch(const config::error& /*e*/) {
std::cerr << "Could not parse config file\n";
return 1;
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
std::cerr << "File I/O error: " << e.what() << "\n";
return 2;
} catch(std::bad_function_call& /*e*/) {
} catch(const std::bad_function_call& /*e*/) {
std::cerr << "Bad request handler function call\n";
return 4;
}

View file

@ -518,7 +518,7 @@ void commandline_options::parse_resolution_ ( const std::string& resolution_stri
try {
xres = std::stoi(tokens[0]);
yres = std::stoi(tokens[1]);
} catch(std::invalid_argument &) {
} catch(const std::invalid_argument &) {
throw bad_commandline_resolution(resolution_string);
}
@ -541,7 +541,7 @@ std::vector<std::pair<unsigned int,std::string>> commandline_options::parse_to_u
unsigned int temp;
try {
temp = lexical_cast<unsigned int>(tokens[0]);
} catch (bad_lexical_cast &) {
} catch (const bad_lexical_cast &) {
throw bad_commandline_tuple(s, expected_format);
}
@ -566,7 +566,7 @@ std::vector<std::tuple<unsigned int,std::string,std::string>> commandline_option
unsigned int temp;
try {
temp = lexical_cast<unsigned int>(tokens[0]);
} catch (bad_lexical_cast &) {
} catch (const bad_lexical_cast &) {
throw bad_commandline_tuple(s, expected_format);
}

View file

@ -175,9 +175,9 @@ void config_cache::read_cache(const std::string& file_path, config& cfg)
dir_checksum = filesystem::file_tree_checksum(checksum_cfg);
}
} catch(config::error&) {
} catch(const config::error&) {
ERR_CACHE << "cache checksum is corrupt" << std::endl;
} catch(filesystem::io_exception&) {
} catch(const filesystem::io_exception&) {
ERR_CACHE << "error reading cache checksum" << std::endl;
}
}
@ -199,11 +199,11 @@ void config_cache::read_cache(const std::string& file_path, config& cfg)
}
return;
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_CACHE << "cache " << fname << extension << " is corrupt. Loading from files: "<< e.message << std::endl;
} catch(filesystem::io_exception&) {
} catch(const filesystem::io_exception&) {
ERR_CACHE << "error reading cache " << fname << extension << ". Loading from files" << std::endl;
} catch (boost::iostreams::gzip_error& e) {
} catch (const boost::iostreams::gzip_error& e) {
//read_file -> ... -> read_gz can throw this exception.
ERR_CACHE << "cache " << fname << extension << " is corrupt. Error code: " << e.error() << std::endl;
}
@ -227,7 +227,7 @@ void config_cache::read_cache(const std::string& file_path, config& cfg)
filesystem::data_tree_checksum().write(checksum_cfg);
write_file(fname_checksum, checksum_cfg);
} catch(filesystem::io_exception&) {
} catch(const filesystem::io_exception&) {
ERR_CACHE << "could not write to cache '" << fname << "'" << std::endl;
}

View file

@ -340,7 +340,7 @@ void display::init_flags_for_side_internal(std::size_t n, const std::string& sid
str = sub_items.front();
try {
time = std::max<int>(1, std::stoi(sub_items.back()));
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_DP << "Invalid time value found when constructing flag for side " << n << ": " << sub_items.back() << "\n";
}
}

View file

@ -174,10 +174,10 @@ EXIT_STATUS editor_controller::main_loop()
while (!do_quit_) {
play_slice();
}
} catch (editor_exception& e) {
} catch (const editor_exception& e) {
gui2::show_transient_message(_("Fatal error"), e.what());
return EXIT_ERROR;
} catch (wml_exception& e) {
} catch (const wml_exception& e) {
e.show();
}
return quit_mode_;
@ -193,7 +193,7 @@ void editor_controller::do_screenshot(const std::string& screenshot_filename /*
if(screenshot.null() || image::save_image(screenshot, screenshot_filename) != image::save_result::success) {
ERR_ED << "Screenshot creation failed!\n";
}
} catch (wml_exception& e) {
} catch (const wml_exception& e) {
e.show();
}
}

View file

@ -62,7 +62,7 @@ EXIT_STATUS start(const config& game_conf, const std::string& filename /* = "" *
if (!take_screenshot)
e = editor.main_loop();
} catch (editor_exception& e) {
} catch(const editor_exception& e) {
ERR_ED << "Editor exception in editor::start: " << e.what() << std::endl;
throw;
}

View file

@ -469,10 +469,10 @@ void context_manager::apply_mask_dialog()
map_context mask(game_config_, dlg.path());
editor_action_apply_mask a(mask.map());
perform_refresh(a);
} catch (editor_map_load_exception& e) {
} catch (const editor_map_load_exception& e) {
gui2::show_transient_message(_("Error loading mask"), e.what());
return;
} catch (editor_action_exception& e) {
} catch (const editor_action_exception& e) {
gui2::show_error_message(e.what());
return;
}
@ -512,10 +512,10 @@ void context_manager::create_mask_to_dialog()
map_context map(game_config_, dlg.path());
editor_action_create_mask a(map.map());
perform_refresh(a);
} catch (editor_map_load_exception& e) {
} catch (const editor_map_load_exception& e) {
gui2::show_transient_message(_("Error loading map"), e.what());
return;
} catch (editor_action_exception& e) {
} catch (const editor_action_exception& e) {
gui2::show_error_message(e.what());
return;
}
@ -705,7 +705,7 @@ void context_manager::generate_map_dialog()
map_generator* const map_generator = dialog.get_selected_map_generator();
try {
map_string = map_generator->create_map(dialog.get_seed());
} catch (mapgen_exception& e) {
} catch (const mapgen_exception& e) {
gui2::show_transient_message(_("Map creation failed."), e.what());
return;
}
@ -832,7 +832,7 @@ bool context_manager::write_scenario(bool display_confirmation)
if(display_confirmation) {
gui2::show_transient_message("", _("Scenario saved."));
}
} catch (editor_map_save_exception& e) {
} catch (const editor_map_save_exception& e) {
gui2::show_transient_message("", e.what());
return false;
}
@ -847,7 +847,7 @@ bool context_manager::write_map(bool display_confirmation)
if(display_confirmation) {
gui2::show_transient_message("", _("Map saved."));
}
} catch (editor_map_save_exception& e) {
} catch (const editor_map_save_exception& e) {
gui2::show_transient_message("", e.what());
return false;
}
@ -922,7 +922,7 @@ void context_manager::load_map(const std::string& filename, bool new_context)
}
}
}
} catch (editor_map_load_exception& e) {
} catch(const editor_map_load_exception& e) {
gui2::show_transient_message(_("Error loading map"), e.what());
return;
}

View file

@ -56,11 +56,11 @@ editor_map editor_map::from_string(const config& terrain_cfg, const std::string&
{
try {
return editor_map(terrain_cfg, data);
} catch (incorrect_map_format_error& e) {
} catch (const incorrect_map_format_error& e) {
throw wrap_exc("format", e.message, "");
} catch (wml_exception& e) {
} catch (const wml_exception& e) {
throw wrap_exc("wml", e.user_message, "");
} catch (config::error& e) {
} catch (const config::error& e) {
throw wrap_exc("config", e.message, "");
}
}

View file

@ -182,7 +182,7 @@ map_context::map_context(const config& game_config, const std::string& filename)
// 4.0 editor generated scenario
try {
load_scenario(game_config);
} catch(config::error& e) {
} catch(const config::error& e) {
// We already caught and rethrew this exception in load_scenario
throw editor_map_load_exception("load_scenario", e.message);
}
@ -318,7 +318,7 @@ void map_context::load_scenario(const config& game_config)
try {
read(scenario, *(preprocess_file(filename_)));
} catch(config::error& e) {
} catch(const config::error& e) {
LOG_ED << "Caught a config error while parsing file: '" << filename_ << "'\n" << e.message << std::endl;
throw;
}
@ -598,7 +598,7 @@ bool map_context::save_scenario()
}
clear_modified();
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
utils::string_map symbols;
symbols["msg"] = e.what();
const std::string msg = VGETTEXT("Could not save the scenario: $msg", symbols);
@ -640,7 +640,7 @@ bool map_context::save_map()
add_to_recent_files();
clear_modified();
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
utils::string_map symbols;
symbols["msg"] = e.what();
const std::string msg = VGETTEXT("Could not save the map: $msg", symbols);

View file

@ -907,7 +907,7 @@ filesystem::scoped_ostream ostream_file(const std::string& fname, bool create_di
try {
boost::iostreams::file_descriptor_sink fd(bfs::path(fname), std::ios_base::binary);
return std::make_unique<boost::iostreams::stream<boost::iostreams::file_descriptor_sink>>(fd, 4096, 0);
} catch(BOOST_IOSTREAMS_FAILURE& e) {
} catch(const BOOST_IOSTREAMS_FAILURE& e) {
// If this operation failed because the parent directory didn't exist, create the parent directory and
// retry.
error_code ec_unused;

View file

@ -139,7 +139,7 @@ bool load_font_config()
filesystem::scoped_istream stream = preprocess_file(cfg_path);
read(cfg, *stream);
} catch(config::error &e) {
} catch(const config::error &e) {
ERR_FT << "could not read fonts.cfg:\n"
<< e.message << '\n';
return false;

View file

@ -39,7 +39,7 @@ namespace utils {
try {
const wfl::formula form(formula);
return form.evaluate().string_cast();
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
ERR_NG << "Formula in WML string cannot be evaluated due to "
<< e.type << "\n\t--> \"";
return "";
@ -205,7 +205,7 @@ formula::formula(const std::string& text, function_symbol_table* symbols)
tokens.back().filename = &(*filenames_it);
tokens.back().line_number = files.back().second;
}
} catch(tk::token_error& e) {
} catch(const tk::token_error& e) {
// When we catch token error, we should write whole line in which error occurred,
// so we merge info from token and everything we had in the line so far
std::string str = "";
@ -263,7 +263,7 @@ variant formula::execute(const formula_callable& variables, formula_debugger*fdb
{
try {
return expr_->evaluate(variables, fdb);
} catch(type_error& e) {
} catch(const type_error& e) {
std::cerr << "formula type error: " << e.message << "\n";
return variant();
}
@ -1376,7 +1376,7 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
parse_expression(tok + 1, i2 - 1, symbols)
)
);
} catch (formula_error& e){
} catch (const formula_error& e){
throw formula_error( e.type, tokens_to_string(i1, i2-1), *i1->filename, i1->line_number );
}
}
@ -1440,7 +1440,7 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
try{
return symbols->create_function(std::string(i1->begin, i1->end),args);
}
catch(formula_error& e) {
catch(const formula_error& e) {
throw formula_error(e.type, tokens_to_string(function_call_begin, function_call_end), *i1->filename, i1->line_number);
}
}
@ -1457,7 +1457,7 @@ expression_ptr parse_expression(const tk::token* i1, const tk::token* i2, functi
try{
return expression_ptr(
new unary_operator_expression(std::string(op->begin, op->end), parse_expression(op + 1, i2 ,symbols)));
} catch(formula_error& e) {
} catch(const formula_error& e) {
throw formula_error( e.type, tokens_to_string(begin,end - 1), *op->filename, op->line_number);
}
}

View file

@ -72,7 +72,7 @@ static T& value_ref_cast(variant_value_base& ptr)
{
try {
return dynamic_cast<T&>(ptr);
} catch(std::bad_cast&) {
} catch(const std::bad_cast&) {
throw type_error("Could not cast type");
}
}

View file

@ -376,7 +376,7 @@ void load_config(const config &v)
for(const auto& s : utils::split(v[key].str())) {
try {
color_vec.push_back(color_t::from_hex_string(s));
} catch(std::invalid_argument& e) {
} catch(const std::invalid_argument& e) {
ERR_NG << "Error parsing color list '" << key << "'.\n" << e.what() << std::endl;
color_vec.push_back(fallback);
}
@ -449,7 +449,7 @@ void add_color_info(const config& v, bool build_defaults)
for(const auto& s : utils::split(*a2)) {
try {
temp.push_back(color_t::from_hex_string(s));
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
std::stringstream ss;
ss << "can't parse color string:\n" << teamC.debug() << "\n";
throw config::error(ss.str());
@ -478,7 +478,7 @@ void add_color_info(const config& v, bool build_defaults)
for(const auto& s : utils::split(rgb.second)) {
try {
temp.push_back(color_t::from_hex_string(s));
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_NG << "Invalid color in palette: " << s << std::endl;
}
}
@ -508,7 +508,7 @@ const color_range& color_info(const std::string& name)
for(const auto& s : utils::split(name)) {
try {
temp.push_back(color_t::from_hex_string(s));
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
throw config::error(_("Invalid color in range: ") + s);
}
}
@ -528,7 +528,7 @@ const std::vector<color_t>& tc_info(const std::string& name)
for(const auto& s : utils::split(name)) {
try {
temp.push_back(color_t::from_hex_string(s));
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
static std::vector<color_t> stv;
ERR_NG << "Invalid color in palette: " << s << std::endl;
return stv;

View file

@ -301,7 +301,7 @@ void game_config_manager::load_game_config(FORCE_RELOAD_CONFIG force_reload,
tdata_ = std::make_shared<terrain_type_data>(game_config_);
::init_strings(game_config());
theme::set_known_themes(&game_config());
} catch(game::error& e) {
} catch(const game::error& e) {
ERR_CONFIG << "Error loading game configuration files\n" << e.message << '\n';
// Try reloading without add-ons
@ -453,17 +453,17 @@ void game_config_manager::load_addons_cfg()
}
game_config_.append(umc_cfg);
} catch(config::error& err) {
} catch(const config::error& err) {
ERR_CONFIG << "error reading usermade add-on '" << addon.main_cfg << "'" << std::endl;
ERR_CONFIG << err.message << '\n';
error_addons.push_back(addon.main_cfg);
error_log.push_back(err.message);
} catch(preproc_config::error& err) {
} catch(const preproc_config::error& err) {
ERR_CONFIG << "error reading usermade add-on '" << addon.main_cfg << "'" << std::endl;
ERR_CONFIG << err.message << '\n';
error_addons.push_back(addon.main_cfg);
error_log.push_back(err.message);
} catch(filesystem::io_exception&) {
} catch(const filesystem::io_exception&) {
ERR_CONFIG << "error reading usermade add-on '" << addon.main_cfg << "'" << std::endl;
error_addons.push_back(addon.main_cfg);
}
@ -557,7 +557,7 @@ void game_config_manager::load_game_config_for_game(
try {
load_game_config_with_loadscreen(NO_FORCE_RELOAD, &classification);
} catch(game::error&) {
} catch(const game::error&) {
cache_.clear_defines();
std::deque<define> previous_defines;
@ -584,7 +584,7 @@ void game_config_manager::load_game_config_for_create(bool is_mp, bool is_test)
try{
load_game_config_with_loadscreen(NO_INCLUDE_RELOAD);
}
catch(game::error&) {
catch(const game::error&) {
cache_.clear_defines();
std::deque<define> previous_defines;

View file

@ -615,11 +615,11 @@ WML_HANDLER_FUNCTION(replace_map,, cfg)
deprecated_message("[replace_map]map=", DEP_LEVEL::INDEFINITE, "1.16", "Use map_data= instead.");
map.read(cfg["map"], false);
}
} catch(incorrect_map_format_error&) {
} catch(const incorrect_map_format_error&) {
const std::string log_map_name = cfg["map"].empty() ? cfg["map_file"] : std::string("from inline data");
lg::wml_error() << "replace_map: Unable to load map " << log_map_name << std::endl;
return;
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
return;
}
@ -881,10 +881,10 @@ WML_HANDLER_FUNCTION(terrain_mask,, cfg)
} else {
mask_map.read(cfg["mask"], false);
}
} catch(incorrect_map_format_error&) {
} catch(const incorrect_map_format_error&) {
ERR_NG << "terrain mask is in the incorrect format, and couldn't be applied" << std::endl;
return;
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
return;
}

View file

@ -69,11 +69,11 @@ void scenario::set_metadata()
try {
map_.reset(new gamemap(game_config_manager::get()->terrain_types(),
map_data));
} catch(incorrect_map_format_error& e) {
} catch(const incorrect_map_format_error& e) {
data_["description"] = _("Map could not be loaded: ") + e.message;
ERR_CF << "map could not be loaded: " << e.message << '\n';
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
data_["description"] = _("Map could not be loaded.");
ERR_CF << "map could not be loaded: " << e.dev_message << '\n';
@ -335,7 +335,7 @@ void create_engine::init_generated_level_data()
cur_lev->set_data(data);
}
} catch (mapgen_exception & e) {
} catch (const mapgen_exception & e) {
config data = cur_lev->data();
data["error_message"] = e.what();
@ -520,7 +520,7 @@ void create_engine::set_current_level(const std::size_t index)
{
try {
current_level_index_ = type_map_.at(current_level_type_.v).games_filtered.at(index);
} catch (std::out_of_range&) {
} catch (const std::out_of_range&) {
current_level_index_ = 0u;
}
@ -662,11 +662,11 @@ void create_engine::init_all_levels()
std::unique_ptr<gamemap> map;
try {
map.reset(new gamemap(game_config_manager::get()->terrain_types(), user_map_data["map_data"]));
} catch (incorrect_map_format_error& e) {
} catch (const incorrect_map_format_error& e) {
user_map_data["description"] = _("Map could not be loaded: ") + e.message;
ERR_CF << "map could not be loaded: " << e.message << '\n';
} catch (wml_exception&) {
} catch (const wml_exception&) {
add_map = false;
dep_index_offset++;
}
@ -689,7 +689,7 @@ void create_engine::init_all_levels()
config data;
try {
read(data, *preprocess_file(filesystem::get_user_data_dir() + "/editor/scenarios/" + user_scenario_names_[i]));
} catch (config::error & e) {
} catch(const config::error & e) {
ERR_CF << "Caught a config error while parsing user made (editor) scenarios:\n" << e.message << std::endl;
ERR_CF << "Skipping file: " << (filesystem::get_user_data_dir() + "/editor/scenarios/" + user_scenario_names_[i]) << std::endl;
continue;

View file

@ -314,9 +314,9 @@ game_info::game_info(const config& game, const config& game_config, const std::v
msi << map.w() << font::unicode_multiplication_sign << map.h();
map_size_info = msi.str();
info_stream << spaced_em_dash() << map_size_info;
} catch(incorrect_map_format_error&) {
} catch(const incorrect_map_format_error&) {
verified = false;
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
ERR_CF << "map could not be loaded: " << e.dev_message << '\n';
verified = false;
}

View file

@ -138,7 +138,7 @@ bool lobby_info::process_gamelist_diff(const config& data)
try {
gamelist_.apply_diff(data, true);
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_LB << "Error while applying the gamelist diff: '" << e.message << "' Getting a new gamelist.\n";
return false;
}
@ -188,7 +188,7 @@ bool lobby_info::process_gamelist_diff(const config& data)
try {
gamelist_.clear_diff_track(data);
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_LB << "Error while applying the gamelist diff (2): '" << e.message << "' Getting a new gamelist.\n";
return false;
}

View file

@ -268,7 +268,7 @@ std::pair<wesnothd_connection_ptr, config> open_connection(std::string host)
if(outer_salt.size() != 32)
throw utils::hash_error("salt wrong size");
sp["password"] = utils::md5(hash.base64_digest(), outer_salt).base64_digest();
} catch(utils::hash_error& err) {
} catch(const utils::hash_error& err) {
ERR_MP << "bcrypt hash failed: " << err.what() << std::endl;
throw wesnothd_error(_("Bad data received from server"));
}
@ -542,7 +542,7 @@ bool enter_lobby_mode(mp_workflow_helper_ptr helper, const std::vector<std::stri
case gui2::dialogs::mp_lobby::CREATE:
try {
enter_create_mode(helper);
} catch(config::error& error) {
} catch(const config::error& error) {
if(!error.message.empty()) {
gui2::show_error_message(error.message);
}
@ -559,7 +559,7 @@ bool enter_lobby_mode(mp_workflow_helper_ptr helper, const std::vector<std::stri
dlg_joined_game_id,
dlg_retval == gui2::dialogs::mp_lobby::OBSERVE
);
} catch(config::error& error) {
} catch(const config::error& error) {
if(!error.message.empty()) {
gui2::show_error_message(error.message);
}

View file

@ -287,24 +287,24 @@ LEVEL_RESULT campaign_controller::play_game()
{
res = playmp_scenario(end_level);
}
} catch(game::load_game_failed& e) {
} catch(const game::load_game_failed& e) {
gui2::show_error_message(_("The game could not be loaded: ") + e.message);
return LEVEL_RESULT::QUIT;
} catch(quit_game_exception&) {
} catch(const quit_game_exception&) {
LOG_NG << "The game was aborted\n";
return LEVEL_RESULT::QUIT;
} catch(game::game_error& e) {
} catch(const game::game_error& e) {
gui2::show_error_message(_("Error while playing the game: ") + e.message);
return LEVEL_RESULT::QUIT;
} catch(incorrect_map_format_error& e) {
} catch(const incorrect_map_format_error& e) {
gui2::show_error_message(_("The game map could not be loaded: ") + e.message);
return LEVEL_RESULT::QUIT;
} catch (mapgen_exception& e) {
} catch(const mapgen_exception& e) {
gui2::show_error_message(_("Map generator error: ") + e.message);
} catch(config::error& e) {
} catch(const config::error& e) {
gui2::show_error_message(_("Error while reading the WML: ") + e.message);
return LEVEL_RESULT::QUIT;
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
return LEVEL_RESULT::QUIT;
}

View file

@ -51,7 +51,7 @@ bool enter_create_mode(saved_game& state, jump_to_campaign_info jump_to_campaign
try {
dlg.show();
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
return false;
}

View file

@ -442,7 +442,7 @@ bool game_launcher::init_lua_script()
}
return true;
} catch (std::exception & e) {
} catch (const std::exception & e) {
gui2::show_error_message(std::string("When loading a plugin, error:\n") + e.what());
error = true;
}
@ -489,7 +489,7 @@ bool game_launcher::play_test()
try {
campaign_controller ccontroller(state_, game_config_manager::get()->game_config(), game_config_manager::get()->terrain_types());
ccontroller.play_game();
} catch (savegame::load_game_exception &e) {
} catch(const savegame::load_game_exception &e) {
load_data_.reset(new savegame::load_game_metadata(std::move(e.data_)));
return true;
}
@ -526,7 +526,7 @@ int game_launcher::unit_test()
if (!(res == LEVEL_RESULT::VICTORY) || lg::broke_strict()) {
return 1;
}
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
std::cerr << "Caught WML Exception:" << e.dev_message << std::endl;
return 1;
}
@ -553,7 +553,7 @@ int game_launcher::unit_test()
std::cerr << "Observed failure on replay" << std::endl;
return 4;
}
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
std::cerr << "WML Exception while playing replay: " << e.dev_message << std::endl;
return 4; //failed with an error during the replay
}
@ -588,7 +588,7 @@ bool game_launcher::play_render_image_mode()
try {
game_config_manager::get()->
load_game_config_for_game(state_.classification());
} catch(config::error& e) {
} catch(const config::error& e) {
std::cerr << "Error loading game config: " << e.what() << std::endl;
return false;
}
@ -633,13 +633,13 @@ bool game_launcher::load_game()
try {
game_config_manager::get()->
load_game_config_for_game(state_.classification());
} catch(config::error&) {
} catch(const config::error&) {
return false;
}
load.set_gamestate();
} catch(config::error& e) {
} catch(const config::error& e) {
if(e.message.empty()) {
gui2::show_error_message(_("The file you have tried to load is corrupt"));
}
@ -647,17 +647,17 @@ bool game_launcher::load_game()
gui2::show_error_message(_("The file you have tried to load is corrupt: '") + e.message + '\'');
}
return false;
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
return false;
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
if(e.message.empty()) {
gui2::show_error_message(_("File I/O Error while reading the game"));
} else {
gui2::show_error_message(_("File I/O Error while reading the game: '") + e.message + '\'');
}
return false;
} catch(game::error& e) {
} catch(const game::error& e) {
if(e.message.empty()) {
gui2::show_error_message(_("The file you have tried to load is corrupt"));
}
@ -810,13 +810,13 @@ bool game_launcher::play_multiplayer(mp_selection res)
{
try {
start_wesnothd();
} catch(game::mp_server_error&)
} catch(const game::mp_server_error&)
{
preferences::show_wesnothd_server_search();
try {
start_wesnothd();
} catch(game::mp_server_error&)
} catch(const game::mp_server_error&)
{
return false;
}
@ -854,22 +854,22 @@ bool game_launcher::play_multiplayer(mp_selection res)
multiplayer_server_.clear();
}
} catch(wesnothd_rejected_client_error& e) {
} catch(const wesnothd_rejected_client_error& e) {
gui2::show_error_message(e.message);
} catch(game::mp_server_error& e) {
} catch(const game::mp_server_error& e) {
gui2::show_error_message(_("Error while starting server: ") + e.message);
} catch(game::load_game_failed& e) {
} catch(const game::load_game_failed& e) {
gui2::show_error_message(_("The game could not be loaded: ") + e.message);
} catch(game::game_error& e) {
} catch(const game::game_error& e) {
gui2::show_error_message(_("Error while playing the game: ") + e.message);
} catch (mapgen_exception& e) {
} catch (const mapgen_exception& e) {
gui2::show_error_message(_("Map generator error: ") + e.message);
} catch(wesnothd_error& e) {
} catch(const wesnothd_error& e) {
if(!e.message.empty()) {
ERR_NET << "caught network error: " << e.message << std::endl;
std::string user_msg;
auto conn_err = dynamic_cast<wesnothd_connection_error*>(&e);
auto conn_err = dynamic_cast<const wesnothd_connection_error*>(&e);
if(conn_err) {
// The wesnothd_connection_error subclass is only thrown with messages
@ -890,21 +890,21 @@ bool game_launcher::play_multiplayer(mp_selection res)
} else {
ERR_NET << "caught network error" << std::endl;
}
} catch(config::error& e) {
} catch(const config::error& e) {
if(!e.message.empty()) {
ERR_CONFIG << "caught config::error: " << e.message << std::endl;
gui2::show_transient_message("", e.message);
} else {
ERR_CONFIG << "caught config::error" << std::endl;
}
} catch(incorrect_map_format_error& e) {
} catch(const incorrect_map_format_error& e) {
gui2::show_error_message(_("The game map could not be loaded: ") + e.message);
} catch (savegame::load_game_exception & e) {
} catch (const 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(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
} catch (game::error & e) {
} catch (const game::error & e) {
std::cerr << "caught game::error...\n";
gui2::show_error_message(_("Error: ") + e.message);
}
@ -970,7 +970,7 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
try {
game_config_manager::get()->
load_game_config_for_game(state_.classification());
} catch(config::error&) {
} catch(const config::error&) {
return;
}
}
@ -991,12 +991,12 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
gui2::dialogs::end_credits::display(state_.classification().campaign);
}
}
} catch (savegame::load_game_exception &e) {
} catch (const 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(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
} catch(mapgen_exception& e) {
} catch(const mapgen_exception& e) {
gui2::show_error_message(_("Map generator error: ") + e.message);
}
}
@ -1007,10 +1007,10 @@ void game_launcher::play_replay()
try {
campaign_controller ccontroller(state_, game_config_manager::get()->game_config(), game_config_manager::get()->terrain_types());
ccontroller.play_replay();
} catch (savegame::load_game_exception &e) {
} catch (const 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(wml_exception& e) {
} catch(const wml_exception& e) {
e.show();
}
}

View file

@ -161,7 +161,7 @@ void cave_map_generator::cave_map_generator_job::generate_chambers()
try {
min_xpos = std::stoi(items.front()) - 1;
max_xpos = std::stoi(items.back());
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
lg::wml_error() << "Invalid min/max coordinates in cave_map_generator: " << items.front() << ", " << items.back() << "\n";
continue;
}
@ -174,7 +174,7 @@ void cave_map_generator::cave_map_generator_job::generate_chambers()
try {
min_ypos = std::stoi(items.front()) - 1;
max_ypos = std::stoi(items.back());
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
lg::wml_error() << "Invalid min/max coordinates in cave_map_generator: " << items.front() << ", " << items.back() << "\n";
}
}

View file

@ -147,7 +147,7 @@ std::string default_map_generator::generate_map(std::map<map_location,std::strin
try {
map = job.default_generate_map(job_data, labels_ptr, cfg_);
error_message = "";
} catch(mapgen_exception& exc) {
} catch(const mapgen_exception& exc) {
error_message = exc.message;
}
@ -179,7 +179,7 @@ config default_map_generator::create_scenario(boost::optional<uint32_t> randomse
try{
res["map_data"] = generate_map(&labels, randomseed);
}
catch (mapgen_exception& exc){
catch (const mapgen_exception& exc){
res["map_data"] = "";
res["error_message"] = exc.message;
}

View file

@ -49,7 +49,7 @@ void lua_map_generator::user_config()
{
try {
lk_.user_config(user_config_.c_str(), generator_data_);
} catch (game::lua_error & e) {
} catch(const game::lua_error & e) {
std::string msg = "Error when running lua_map_generator user_config.\n";
msg += "The generator was: " + config_name_ + "\n";
msg += e.what();
@ -65,7 +65,7 @@ std::string lua_map_generator::create_map(boost::optional<uint32_t> seed)
try {
return lk_.create_map(create_map_.c_str(), generator_data_, seed);
} catch (game::lua_error & e) {
} catch (const game::lua_error & e) {
std::string msg = "Error when running lua_map_generator create_map.\n";
msg += "The generator was: " + config_name_ + "\n";
msg += e.what();
@ -81,7 +81,7 @@ config lua_map_generator::create_scenario(boost::optional<uint32_t> seed)
try {
return lk_.create_scenario(create_scenario_.c_str(), generator_data_, seed);
} catch (game::lua_error & e) {
} catch (const game::lua_error & e) {
std::string msg = "Error when running lua_map_generator create_scenario.\n";
msg += "The generator was: " + config_name_ + "\n";
msg += e.what();

View file

@ -136,9 +136,9 @@ namespace
po_file.open(path);
const po_catalog& cat = po_catalog::from_istream(po_file);
extra_messages_.emplace(get_base().domain(domain), cat);
} catch(spirit_po::catalog_exception& e) {
} catch(const spirit_po::catalog_exception& e) {
throw_po_error(lang_name_long, domain, e.what());
} catch(std::ios::failure&) {
} catch(const std::ios::failure&) {
throw_po_error(lang_name_long, domain, strerror(errno));
}
}

View file

@ -54,7 +54,7 @@ advanced_graphics_options::SCALING_ALGORITHM advanced_graphics_options::get_scal
try {
algo = SCALING_ALGORITHM::string_to_enum(preferences::get(pref_id));
} catch(bad_enum_cast&) {
} catch(const bad_enum_cast&) {
preferences::set(pref_id, algo.to_string());
}

View file

@ -257,7 +257,7 @@ const time_of_day& custom_tod::get_selected_tod() const
{
try {
return times_.at(current_tod_);
} catch(std::out_of_range&) {
} catch(const std::out_of_range&) {
throw std::string("Attempted to fetch a non-existant ToD!");
}
}

View file

@ -343,7 +343,7 @@ void game_load::evaluate_summary_string(std::stringstream& str, const config& cf
str << _("Test scenario");
break;
}
} catch(bad_enum_cast&) {
} catch(const bad_enum_cast&) {
str << campaign_type;
}

View file

@ -420,7 +420,7 @@ bool lua_interpreter::lua_model::execute (const std::string & cmd)
try {
L_.interactive_run(cmd.c_str());
return true;
} catch (game::lua_error & e) {
} catch (const game::lua_error & e) {
add_dialog_message(std::string(e.what()));
return false;
}

View file

@ -864,7 +864,7 @@ void mp_lobby::network_handler()
if (network_connection_.receive_data(data)) {
process_network_data(data);
}
} catch (wesnothd_error& e) {
} catch (const wesnothd_error& e) {
LOG_LB << "caught wesnothd_error in network_handler: " << e.message << "\n";
throw;
}

View file

@ -599,7 +599,7 @@ void preferences_dialog::post_build(window& window)
ADVANCED_PREF_TYPE pref_type;
try {
pref_type = ADVANCED_PREF_TYPE::string_to_enum(option["type"].str());
} catch(bad_enum_cast&) {
} catch(const bad_enum_cast&) {
continue;
}

View file

@ -40,7 +40,7 @@ public:
if(viewer.controller_.max_parts() > 0) {
viewer.show();
}
} catch(std::out_of_range&) {}
} catch(const std::out_of_range&) {}
}
private:

View file

@ -371,7 +371,7 @@ void title_screen::pre_show(window& win)
::image::flush_cache();
on_resize(win);
}
} catch(std::runtime_error& e) {
} catch(const std::runtime_error& e) {
gui2::show_error_message(e.what());
}
});

View file

@ -169,7 +169,7 @@ void show(const std::string& window_id,
{
t.show();
}
catch(window_builder_invalid_id&)
catch(const window_builder_invalid_id&)
{
ERR_CFG << "Tip with the requested id '" << window_id
<< "' doesn't exist, fall back to the default.\n";
@ -178,7 +178,7 @@ void show(const std::string& window_id,
{
t.show();
}
catch(window_builder_invalid_id&)
catch(const window_builder_invalid_id&)
{
ERR_CFG << "Default tooltip doesn't exist, no message shown."
<< std::endl;

View file

@ -54,7 +54,7 @@ void init()
filesystem::scoped_istream stream = preprocess_file(filesystem::get_wml_location("gui/_main.cfg"), &preproc);
read(cfg, *stream, &validator);
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_GUI_P << e.what() << '\n';
ERR_GUI_P << "Setting: could not read file 'data/gui/_main.cfg'." << std::endl;
} catch(const abstract_validator::error& e) {

View file

@ -218,7 +218,7 @@ const surface minimap::get_image(const int w, const int h) const
#endif
return surf;
}
catch(incorrect_map_format_error& e)
catch(const incorrect_map_format_error& e)
{
ERR_CF << "Error while loading the map: " << e.message << '\n';
#ifdef DEBUG_MINIMAP_CACHE

View file

@ -47,7 +47,7 @@ void size_lock::place(const point& origin, const point& size)
if(content_size.y > size.y) {
try {
reduce_height(size.y);
} catch(layout_exception_width_modified&) {
} catch(const layout_exception_width_modified&) {
}
content_size = widget_->get_best_size();

View file

@ -949,7 +949,7 @@ void window::layout()
{
window_implementation::layout(*this, maximum_width, maximum_height);
}
catch(layout_exception_resize_failed&)
catch(const layout_exception_resize_failed&)
{
/** @todo implement the scrollbars on the window. */
@ -985,7 +985,7 @@ void window::layout()
window_implementation::layout(
*this, maximum_width, maximum_height);
}
catch(layout_exception_resize_failed&)
catch(const layout_exception_resize_failed&)
{
/** @todo implement the scrollbars on the window. */
@ -1261,7 +1261,7 @@ void window_implementation::layout(window& window,
DBG_GUI_L << LOG_IMPL_HEADER << " Result: Resizing succeeded.\n";
return;
}
catch(layout_exception_width_modified&)
catch(const layout_exception_width_modified&)
{
DBG_GUI_L << LOG_IMPL_HEADER
<< " Status: Width has been modified, rerun.\n";

View file

@ -318,7 +318,7 @@ int halo_impl::add(int x, int y, const std::string& image, const map_location& l
str = sub_items.front();
try {
time = std::stoi(sub_items.back());
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_DP << "Invalid time value found when constructing halo: " << sub_items.back() << "\n";
}
}

View file

@ -1330,7 +1330,7 @@ bool update_from_preferences()
SCALING_ALGORITHM algo = preferences::default_scaling_algorithm;
try {
algo = SCALING_ALGORITHM::string_to_enum(preferences::get("scale_hex"));
} catch(bad_enum_cast&) {
} catch(const bad_enum_cast&) {
}
scale_to_hex_func = select_algorithm(algo);
@ -1338,7 +1338,7 @@ bool update_from_preferences()
algo = preferences::default_scaling_algorithm;
try {
algo = SCALING_ALGORITHM::string_to_enum(preferences::get("scale_zoom"));
} catch(bad_enum_cast&) {
} catch(const bad_enum_cast&) {
}
scale_to_zoom_func = select_algorithm(algo);

View file

@ -708,7 +708,7 @@ REGISTER_MOD_PARSER(RC, args)
const std::vector<color_t>& old_color = game_config::tc_info(recolor_params[0]);
rc_map = recolor_range(new_color,old_color);
} catch (config::error& e) {
} catch (const config::error& e) {
ERR_DP
<< "caught config::error while processing color-range RC: "
<< e.message
@ -742,7 +742,7 @@ REGISTER_MOD_PARSER(PAL, args)
}
return new rc_modification(rc_map);
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_DP
<< "caught config::error while processing PAL function: "
<< e.message
@ -816,7 +816,7 @@ REGISTER_MOD_PARSER(BW, args)
} else {
return new bw_modification(threshold);
}
} catch (std::invalid_argument&) {
} catch (const std::invalid_argument&) {
ERR_DP << "unsupported argument in ~BW() function" << std::endl;
return nullptr;
}
@ -849,7 +849,7 @@ REGISTER_MOD_PARSER(NEG, args)
} else {
return new negative_modification(threshold, threshold, threshold);
}
} catch (std::invalid_argument&) {
} catch (const std::invalid_argument&) {
ERR_DP << "unsupported argument value in ~NEG() function" << std::endl;
return nullptr;
}
@ -865,7 +865,7 @@ REGISTER_MOD_PARSER(NEG, args)
} else {
return new negative_modification(thresholdRed, thresholdGreen, thresholdBlue);
}
} catch (std::invalid_argument&) {
} catch (const std::invalid_argument&) {
ERR_DP << "unsupported argument value in ~NEG() function" << std::endl;
return nullptr;
}

View file

@ -99,7 +99,7 @@ bool load_language_list()
try {
filesystem::scoped_istream stream = preprocess_file(filesystem::get_wml_location("hardwired/language.cfg"));
read(cfg, *stream);
} catch(config::error &) {
} catch(const config::error &) {
return false;
}

View file

@ -44,7 +44,7 @@ struct language_def
{
try {
this->percent = percent.empty() ? 100 : std::stoi(percent);
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
this->percent = 100;
}
}

View file

@ -228,8 +228,8 @@ struct lexical_caster<
try {
return std::stoll(value);
} catch(std::invalid_argument&) {
} catch(std::out_of_range&) {
} catch(const std::invalid_argument&) {
} catch(const std::out_of_range&) {
}
if(fallback) {
@ -286,8 +286,8 @@ struct lexical_caster<
if(std::numeric_limits<To>::lowest() <= res && std::numeric_limits<To>::max() >= res) {
return static_cast<To>(res);
}
} catch(std::invalid_argument&) {
} catch(std::out_of_range&) {
} catch(const std::invalid_argument&) {
} catch(const std::out_of_range&) {
}
if(fallback) {
@ -353,8 +353,8 @@ struct lexical_caster<
if((static_cast<long double>(std::numeric_limits<To>::lowest()) <= res) && (static_cast<long double>(std::numeric_limits<To>::max()) >= res)) {
return static_cast<To>(res);
}
} catch(std::invalid_argument&) {
} catch(std::out_of_range&) {
} catch(const std::invalid_argument&) {
} catch(const std::out_of_range&) {
}
if(fallback) {
@ -412,8 +412,8 @@ struct lexical_caster<
try {
return std::stoull(value);
} catch(std::invalid_argument&) {
} catch(std::out_of_range&) {
} catch(const std::invalid_argument&) {
} catch(const std::out_of_range&) {
}
if(fallback) {
@ -471,8 +471,8 @@ struct lexical_caster<
if(std::numeric_limits<To>::max() >= res) {
return static_cast<To>(res);
}
} catch(std::invalid_argument&) {
} catch(std::out_of_range&) {
} catch(const std::invalid_argument&) {
} catch(const std::out_of_range&) {
}
if(fallback) {

View file

@ -417,7 +417,7 @@ void terrain_label::read(const config& cfg)
if(!tmp_color.empty()) {
try {
color = color_t::from_rgb_string(tmp_color);
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
// Prior to the color_t conversion, labels were written to savefiles with an alpha key, despite alpha not
// being accepted in color=. Because of this, this enables the loading of older saves without an exception
// throwing.

View file

@ -193,7 +193,7 @@ map_location::map_location(const config& cfg, const variable_set *variables) :
if(xs.empty() == false && xs != "recall") {
try {
x = std::stoi(xs) - 1;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_CF << "Invalid map coordinate: " << xs << "\n";
}
}
@ -201,7 +201,7 @@ map_location::map_location(const config& cfg, const variable_set *variables) :
if(ys.empty() == false && ys != "recall") {\
try {
y = std::stoi(ys) - 1;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_CF << "Invalid map coordinate: " << ys << "\n";
}
}
@ -345,7 +345,7 @@ bool map_location::matches_range(const std::string& xloc, const std::string &ylo
try {
bot = std::stoi(beg) - 1;
top = std::stoi(end) - 1;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_CF << "Invalid map coordinate: " << end << ", " << beg << "\n";
}
@ -356,7 +356,7 @@ bool map_location::matches_range(const std::string& xloc, const std::string &ylo
try {
xval = std::stoi(xloc) - 1;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_CF << "Invalid map coordinate: " << xloc << "\n";
}
@ -377,7 +377,7 @@ bool map_location::matches_range(const std::string& xloc, const std::string &ylo
try {
bot = std::stoi(beg) - 1;
top = std::stoi(end) - 1;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_CF << "Invalid map coordinate: " << end << ", " << beg << "\n";
}
@ -388,7 +388,7 @@ bool map_location::matches_range(const std::string& xloc, const std::string &ylo
try {
yval = std::stoi(yloc) - 1;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_CF << "Invalid map coordinate: " << yloc << "\n";
}

View file

@ -137,7 +137,7 @@ void gamemap::read(const std::string& data, const bool allow_invalid)
try {
tiles_ = t_translation::read_game_map(data_only, starting_positions_, t_translation::coordinate{ border_size(), border_size() });
} catch(t_translation::error& e) {
} catch(const t_translation::error& e) {
// We re-throw the error but as map error.
// Since all codepaths test for this, it's the least work.
throw incorrect_map_format_error(e.message);

View file

@ -188,7 +188,7 @@ void menu_handler::save_map()
try {
filesystem::write_file(dlg.path(), map().write());
gui2::show_transient_message("", _("Map saved."));
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
utils::string_map symbols;
symbols["msg"] = e.what();
const std::string msg = VGETTEXT("Could not save the map: $msg", symbols);
@ -1518,7 +1518,7 @@ void console_handler::do_control()
unsigned int side_num;
try {
side_num = lexical_cast<unsigned int>(side);
} catch(bad_lexical_cast&) {
} catch(const bad_lexical_cast&) {
const auto it_t = std::find_if(
resources::gameboard->teams().begin(), resources::gameboard->teams().end(), save_id_matches(side));
if(it_t == resources::gameboard->teams().end()) {
@ -1548,7 +1548,7 @@ void console_handler::do_controller()
unsigned int side_num;
try {
side_num = lexical_cast<unsigned int>(side);
} catch(bad_lexical_cast&) {
} catch(const bad_lexical_cast&) {
utils::string_map symbols;
symbols["side"] = side;
command_failed(VGETTEXT("Can't query control of invalid side: '$side'.", symbols));
@ -1957,7 +1957,7 @@ void menu_handler::do_ai_formula(const std::string& str, int side_num, mouse_han
{
try {
add_chat_message(time(nullptr), "wfl", 0, ai::manager::get_singleton().evaluate_command(side_num, str));
} catch(wfl::formula_error&) {
} catch(const wfl::formula_error&) {
} catch(...) {
add_chat_message(time(nullptr), "wfl", 0, "UNKNOWN ERROR IN FORMULA");
}

View file

@ -1010,7 +1010,7 @@ void mouse_handler::attack_enemy(const map_location& attacker_loc, const map_loc
{
try {
attack_enemy_(attacker_loc, defender_loc, choice);
} catch(std::bad_alloc&) {
} catch(const std::bad_alloc&) {
lg::wml_error() << "Memory exhausted a unit has either a lot hitpoints or a negative amount.\n";
}
}

View file

@ -39,7 +39,7 @@ void persist_file_context::load()
if (!(file_stream->fail())) {
try {
read(cfg_,*file_stream);
} catch (config::error &err) {
} catch (const config::error &err) {
LOG_PERSIST << err.message << std::endl;
}
}

View file

@ -251,11 +251,11 @@ void playmp_controller::linger()
play_linger_turn();
after_human_turn();
LOG_NG << "finished human turn" << std::endl;
} catch (savegame::load_game_exception&) {
} catch (const savegame::load_game_exception&) {
LOG_NG << "caught load-game-exception" << std::endl;
// this should not happen, the option to load a game is disabled
throw;
} catch (ingame_wesnothd_error&) {
} catch (const ingame_wesnothd_error&) {
LOG_NG << "caught network-error-exception" << std::endl;
quit = false;
}

View file

@ -247,7 +247,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(const config& level)
try {
soundsource::sourcespec spec(s);
soundsources_manager_->add(spec);
} catch (bad_lexical_cast &) {
} catch (const bad_lexical_cast &) {
ERR_NG << "Error when parsing sound_source config: bad lexical cast." << std::endl;
ERR_NG << "sound_source config was: " << s.debug() << std::endl;
ERR_NG << "Skipping this sound source..." << std::endl;
@ -332,12 +332,12 @@ LEVEL_RESULT playsingle_controller::play_scenario(const config& level)
// Loading a new game is effectively a quit.
saved_game_.clear();
throw;
} catch(wesnothd_error& e) {
} catch(const wesnothd_error& e) {
scoped_savegame_snapshot snapshot(*this);
savegame::ingame_savegame save(saved_game_, preferences::save_compression_format());
save.save_game_interactive(_("A network disconnection has occurred, and the game cannot continue. Do you want to save the game?"), savegame::savegame::YES_NO);
if(dynamic_cast<ingame_wesnothd_error*>(&e)) {
if(dynamic_cast<const ingame_wesnothd_error*>(&e)) {
return LEVEL_RESULT::QUIT;
} else {
throw;
@ -543,9 +543,9 @@ void playsingle_controller::play_ai_turn()
ai::manager::get_singleton().play_turn(current_side());
}
}
catch (return_to_play_side_exception&) {
catch (const return_to_play_side_exception&) {
}
catch (fallback_ai_to_human_exception&) {
catch (const fallback_ai_to_human_exception&) {
current_team().make_human();
player_type_changed_ = true;
ai_fallback_ = true;

View file

@ -233,7 +233,7 @@ namespace preferences
filesystem::scoped_ostream credentials_file = filesystem::ostream_file(filesystem::get_credentials_file());
secure_buffer encrypted = encrypt(credentials_data, build_key("global", get_system_username()));
credentials_file->write(reinterpret_cast<const char*>(encrypted.data()), encrypted.size());
} catch(filesystem::io_exception&) {
} catch(const filesystem::io_exception&) {
ERR_CFG << "error writing to credentials file '" << filesystem::get_credentials_file() << "'" << std::endl;
}
}

View file

@ -162,7 +162,7 @@ void write_preferences()
try {
filesystem::scoped_ostream prefs_file = filesystem::ostream_file(filesystem::get_prefs_file());
write(*prefs_file, prefs);
} catch(filesystem::io_exception&) {
} catch(const filesystem::io_exception&) {
ERR_FS << "error writing to preferences file '" << filesystem::get_prefs_file() << "'" << std::endl;
}

View file

@ -460,7 +460,7 @@ static bool fix_rename_command(const config& c, config& async_child)
try {
read_locations(child,steps);
} catch (bad_lexical_cast &) {
} catch(const bad_lexical_cast &) {
WRN_REPLAY << "Warning: Path data contained something which could not be parsed to a sequence of locations:" << "\n config = " << child.debug() << std::endl;
}

View file

@ -32,7 +32,7 @@ save_blocker::~save_blocker() {
controller_ = nullptr;
callback_ = nullptr;
}
} catch (std::exception & e) {
} catch (const std::exception & e) {
std::cerr << "Save blocker dtor swallowing an exception: " << e.what() << "\n";
}
}

View file

@ -59,7 +59,7 @@ void save_index_class::rebuild(const std::string& name, const time_t& modified)
read_save_file(name, full, &dummy);
extract_summary_from_config(full, summary);
} catch(game::load_game_failed&) {
} catch(const game::load_game_failed&) {
summary["corrupt"] = true;
}
@ -105,7 +105,7 @@ void save_index_class::write_save_index()
} else {
write(*stream, data());
}
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
ERR_SAVE << "error writing to save index file: '" << e.what() << "'" << std::endl;
}
}
@ -140,13 +140,13 @@ config& save_index_class::data()
filesystem::scoped_istream stream = filesystem::istream_file(si_file);
try {
read_gz(data_, *stream);
} catch(boost::iostreams::gzip_error&) {
} catch(const boost::iostreams::gzip_error&) {
stream->seekg(0);
read(data_, *stream);
}
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
ERR_SAVE << "error reading save index: '" << e.what() << "'" << std::endl;
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_SAVE << "error parsing save index config file:\n" << e.message << std::endl;
data_.clear();
}

View file

@ -191,7 +191,7 @@ bool loadgame::load_game()
gui2::show_error_message(
_("Warning: The file you have tried to load is corrupt. Loading anyway.\n") +
error_log);
} catch (utf8::invalid_utf8_exception&) {
} catch (const utf8::invalid_utf8_exception&) {
gui2::show_error_message(
_("Warning: The file you have tried to load is corrupt. Loading anyway.\n") +
std::string("(UTF-8 ERROR)"));
@ -469,7 +469,7 @@ bool savegame::save_game(const std::string& filename)
if (show_confirmation_)
gui2::show_transient_message(_("Saved"), _("The game has been saved."));
return true;
} catch(game::save_game_failed& e) {
} catch(const game::save_game_failed& e) {
ERR_SAVE << error_message_ << e.message << std::endl;
gui2::show_error_message(error_message_ + e.message);
@ -520,7 +520,7 @@ void savegame::finish_save_game(const config_writer &out)
throw game::save_game_failed(_("Could not write to file"));
}
save_index_manager.remove(gamestate_.classification().label);
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
throw game::save_game_failed(e.what());
}
}
@ -530,7 +530,7 @@ filesystem::scoped_ostream savegame::open_save_game(const std::string &label)
{
try {
return filesystem::ostream_file(filesystem::get_saves_dir() + "/" + label);
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
throw game::save_game_failed(e.what());
}
}

View file

@ -3823,7 +3823,7 @@ int game_lua_kernel::intf_add_sound_source(lua_State *L)
soundsource::sourcespec spec(cfg);
man->add(spec);
man->update();
} catch (bad_lexical_cast &) {
} catch (const bad_lexical_cast &) {
ERR_LUA << "Error when parsing sound_source config: invalid parameter." << std::endl;
ERR_LUA << "sound_source config was: " << cfg.debug() << std::endl;
ERR_LUA << "Skipping this sound source..." << std::endl;

View file

@ -726,7 +726,7 @@ void lua_kernel_base::run(const char * prog, int nArgs)
{
try {
this->throwing_run(prog, nArgs);
} catch (game::lua_error & e) {
} catch (const game::lua_error & e) {
cmd_log_ << e.what() << "\n";
lua_kernel_base::log_error(e.what(), "In function lua_kernel::run()");
}
@ -743,7 +743,7 @@ void lua_kernel_base::interactive_run(char const * prog) {
try {
// Try to load the experiment without syntax errors
this->load_string(experiment.c_str(), eh);
} catch (game::lua_error &) {
} catch (const game::lua_error &) {
this->throwing_run(prog, 0); // Since it failed, fall back to the usual throwing_run, on the original input.
return;
}

View file

@ -1224,7 +1224,7 @@ bool preprocessor_data::get_chunk()
} else {
deprecation_level = level;
}
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
// Meh, fall back to default of PREEMPTIVE...
deprecation_level = DEP_LEVEL::PREEMPTIVE;
}
@ -1407,7 +1407,7 @@ bool preprocessor_data::get_chunk()
DEP_LEVEL level = DEP_LEVEL::PREEMPTIVE;
try {
level = DEP_LEVEL(std::stoi(read_word()));
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
// Meh, just fall back to the default of PREEMPTIVE...
}
version_info version = game_config::wesnoth_version;

View file

@ -148,7 +148,7 @@ bool schema_validator::read_config_file(const std::string& filename)
preproc_map preproc(game_config::config_cache::instance().get_preproc_map());
filesystem::scoped_istream stream = preprocess_file(filename, &preproc);
read(cfg, *stream);
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_VL << "Failed to read file " << filename << ":\n" << e.what() << "\n";
return false;
}
@ -164,7 +164,7 @@ bool schema_validator::read_config_file(const std::string& filename)
for(const config& type : g.child_range("type")) {
try {
types_[type["name"].str()] = boost::regex(type["value"].str());
} catch(std::exception&) {
} catch(const std::exception&) {
// Need to check all type values in schema-generator
}
}

View file

@ -417,7 +417,7 @@ int apply_modifier( const int number, const std::string &amount, const int minim
int value = 0;
try {
value = std::stoi(amount);
} catch(std::invalid_argument&) {}
} catch(const std::invalid_argument&) {}
if(amount[amount.size()-1] == '%') {
value = div100rounded(number * value);
}
@ -824,7 +824,7 @@ std::pair<int, int> parse_range(const std::string& str)
if (res.second < res.first) {
res.second = res.first;
}
} catch(std::invalid_argument&) {}
} catch(const std::invalid_argument&) {}
return res;
}

View file

@ -77,7 +77,7 @@ std::size_t index(const std::string& str, const std::size_t index)
for (unsigned int chr=0; chr<index && i<len; ++chr) {
i += byte_size_from_utf8_first(str[i]);
}
} catch(invalid_utf8_exception&) {
} catch(const invalid_utf8_exception&) {
ERR_GENERAL << "Invalid UTF-8 string." << std::endl;
}
return i;
@ -90,7 +90,7 @@ std::size_t size(const std::string& str)
for (chr=0; i<len; ++chr) {
i += byte_size_from_utf8_first(str[i]);
}
} catch(invalid_utf8_exception&) {
} catch(const invalid_utf8_exception&) {
ERR_GENERAL << "Invalid UTF-8 string." << std::endl;
}
return chr;

View file

@ -75,7 +75,7 @@ typename ucs4_convert_impl::enableif<TD, typename TS::value_type>::type unicode_
impl_writer::write (dst, impl_reader::read(i1, i2));
}
}
catch(utf8::invalid_utf8_exception&)
catch(const utf8::invalid_utf8_exception&)
{
// TODO: use a ERR_.. stream but I don't know whether I can do so in header easily.
std::cerr << "Failed to convert a string from " << impl_reader::get_name() << " to " << impl_writer::get_name() << "\n";
@ -104,7 +104,7 @@ TD unicode_cast(char32_t onechar)
iteratorwriter<output_itor> dst(inserter);
impl_writer::write (dst, onechar);
}
catch(utf8::invalid_utf8_exception&)
catch(const utf8::invalid_utf8_exception&)
{
// TODO: use a ERR_.. stream but I don't know whether I can do so in header easily.
std::cerr << "Failed to convert a string from " << impl_reader::get_name() << " to " << impl_writer::get_name() << "\n";

View file

@ -276,7 +276,7 @@ static lg::log_domain log_server("server");
if (new_ban->get_end_time() != 0)
time_queue_.push(new_ban);
} catch (banned::error& e) {
} catch (const banned::error& e) {
ERR_SERVER << e.message << " while reading bans" << std::endl;
}
}
@ -289,7 +289,7 @@ static lg::log_domain log_server("server");
try {
banned_ptr new_ban(new banned(b));
deleted_bans_.push_back(new_ban);
} catch (banned::error& e) {
} catch (const banned::error& e) {
ERR_SERVER << e.message << " while reading deleted bans" << std::endl;
}
}
@ -376,7 +376,7 @@ static lg::log_domain log_server("server");
std::string dur_lower;
try {
dur_lower = utf8::lowercase(duration);
} catch ( utf8::invalid_utf8_exception & e ) {
} catch (const utf8::invalid_utf8_exception & e ) {
ERR_SERVER << "While parsing ban command duration string, caught an invalid utf8 exception: " << e.what() << std::endl;
return false;
}
@ -504,7 +504,7 @@ static lg::log_domain log_server("server");
ret << "Overwriting ban: " << (**ban) << "\n";
bans_.erase(ban);
}
} catch (banned::error& e) {
} catch (const banned::error& e) {
ERR_SERVER << e.message << " while creating dummy ban for finding existing ban" << std::endl;
return e.message;
}
@ -514,7 +514,7 @@ static lg::log_domain log_server("server");
if (end_time != 0)
time_queue_.push(new_ban);
ret << *new_ban;
} catch (banned::error& e) {
} catch (const banned::error& e) {
ERR_SERVER << e.message << " while banning" << std::endl;
return e.message;
}
@ -528,7 +528,7 @@ static lg::log_domain log_server("server");
ban_set::iterator ban;
try {
ban = bans_.find(banned::create_dummy(ip));
} catch (banned::error& e) {
} catch (const banned::error& e) {
ERR_SERVER << e.message << std::endl;
os << e.message;
return;
@ -597,7 +597,7 @@ static lg::log_domain log_server("server");
ip_mask pair;
try {
pair = parse_ip(mask);
} catch (banned::error& e) {
} catch (const banned::error& e) {
out << "parse error: " << e.message;
return;
}
@ -626,7 +626,7 @@ static lg::log_domain log_server("server");
ip_mask pair;
try {
pair = parse_ip(mask);
} catch (banned::error& e) {
} catch (const banned::error& e) {
out << "parse error: " << e.message;
return;
}
@ -664,7 +664,7 @@ static lg::log_domain log_server("server");
ip_mask pair;
try {
pair = parse_ip(ip);
} catch (banned::error&) {
} catch (const banned::error&) {
return "";
}
ban_set::const_iterator ban = std::find_if(bans_.begin(), bans_.end(), [pair](const banned_ptr& p) { return p->match_ip(pair); });

View file

@ -70,7 +70,7 @@ bool fuh::login(const std::string& name, const std::string& password, const std:
try {
hash = get_hash(name);
} catch (error& e) {
} catch (const error& e) {
ERR_UH << "Could not retrieve hash for user '" << name << "' :" << e.message << std::endl;
return false;
}
@ -102,7 +102,7 @@ std::string fuh::extract_salt(const std::string& name) {
try {
hash = get_hash(name);
} catch (error& e) {
} catch (const rror& e) {
ERR_UH << "Could not retrieve hash for user '" << name << "' :" << e.message << std::endl;
return "";
}
@ -113,7 +113,7 @@ std::string fuh::extract_salt(const std::string& name) {
if(utils::bcrypt::is_valid_prefix(hash)) {
try {
return utils::bcrypt::from_hash_string(hash).get_salt();
} catch(utils::hash_error& err) {
} catch(const utils::hash_error& err) {
ERR_UH << "Error getting salt from hash of user '" << name << "': " << err.what() << std::endl;
return "";
}
@ -131,7 +131,7 @@ bool fuh::user_exists(const std::string& name) {
// Make a test query for this username
try {
return prepared_statement<bool>("SELECT 1 FROM `" + db_users_table_ + "` WHERE UPPER(username)=UPPER(?)", name);
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not execute test query for user '" << name << "' :" << e.message << std::endl;
// If the database is down just let all usernames log in
return false;
@ -142,7 +142,7 @@ bool fuh::user_is_active(const std::string& name) {
try {
int user_type = get_detail_for_user<int>(name, "user_type");
return user_type != USER_INACTIVE && user_type != USER_IGNORE;
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not retrieve user type for user '" << name << "' :" << e.message << std::endl;
return false;
}
@ -154,7 +154,7 @@ bool fuh::user_is_moderator(const std::string& name) {
try {
return get_writable_detail_for_user<int>(name, "user_is_moderator") == 1;
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not query user_is_moderator for user '" << name << "' :" << e.message << std::endl;
// If the database is down mark nobody as a mod
return false;
@ -167,7 +167,7 @@ void fuh::set_is_moderator(const std::string& name, const bool& is_moderator) {
try {
write_detail(name, "user_is_moderator", int(is_moderator));
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not set is_moderator for user '" << name << "' :" << e.message << std::endl;
}
}
@ -208,7 +208,7 @@ fuh::BAN_TYPE fuh::user_is_banned(const std::string& name, const std::string& ad
return BAN_EMAIL;
}
} catch(sql_error& e) {
} catch(const sql_error& e) {
ERR_UH << "Could not check forum bans on user '" << name << "' :" << e.message << '\n';
}
@ -254,7 +254,7 @@ std::string fuh::get_valid_details() {
std::string fuh::get_hash(const std::string& user) {
try {
return get_detail_for_user<std::string>(user, "user_password");
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not retrieve password for user '" << user << "' :" << e.message << std::endl;
return "";
}
@ -263,7 +263,7 @@ std::string fuh::get_hash(const std::string& user) {
std::string fuh::get_mail(const std::string& user) {
try {
return get_detail_for_user<std::string>(user, "user_email");
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not retrieve email for user '" << user << "' :" << e.message << std::endl;
return "";
}
@ -273,7 +273,7 @@ time_t fuh::get_lastlogin(const std::string& user) {
try {
int time_int = get_writable_detail_for_user<int>(user, "user_lastvisit");
return time_t(time_int);
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not retrieve last visit for user '" << user << "' :" << e.message << std::endl;
return time_t(0);
}
@ -283,7 +283,7 @@ time_t fuh::get_registrationdate(const std::string& user) {
try {
int time_int = get_detail_for_user<int>(user, "user_regdate");
return time_t(time_int);
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not retrieve registration date for user '" << user << "' :" << e.message << std::endl;
return time_t(0);
}
@ -293,7 +293,7 @@ void fuh::set_lastlogin(const std::string& user, const time_t& lastlogin) {
try {
write_detail(user, "user_lastvisit", int(lastlogin));
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not set last visit for user '" << user << "' :" << e.message << std::endl;
}
}
@ -303,7 +303,7 @@ inline T fuh::prepared_statement(const std::string& sql, Args&&... args)
{
try {
return ::prepared_statement<T>(conn, sql, std::forward<Args>(args)...);
} catch (sql_error& e) {
} catch (const sql_error& e) {
WRN_UH << "caught sql error: " << e.message << std::endl;
WRN_UH << "trying to reconnect and retry..." << std::endl;
//Try to reconnect and execute query again
@ -339,7 +339,7 @@ void fuh::write_detail(const std::string& name, const std::string& detail, T&& v
prepared_statement<void>("INSERT INTO `" + db_extra_table_ + "` VALUES(?,?,'0')", name, std::forward<T>(value));
}
prepared_statement<void>("UPDATE `" + db_extra_table_ + "` SET " + detail + "=? WHERE UPPER(username)=UPPER(?)", std::forward<T>(value), name);
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not set detail for user '" << name << "': " << e.message << std::endl;
}
}
@ -349,7 +349,7 @@ bool fuh::extra_row_exists(const std::string& name) {
// Make a test query for this username
try {
return prepared_statement<bool>("SELECT 1 FROM `" + db_extra_table_ + "` WHERE UPPER(username)=UPPER(?)", name);
} catch (sql_error& e) {
} catch (const sql_error& e) {
ERR_UH << "Could not execute test query for user '" << name << "' :" << e.message << std::endl;
return false;
}

View file

@ -1767,7 +1767,7 @@ void game::send_history(const socket_ptr& socket) const
history_.clear();
history_.push_back(doc);
} catch(simple_wml::error& e) {
} catch(const simple_wml::error& e) {
WRN_CONFIG << __func__ << ": simple_wml error: " << e.message << std::endl;
}
}
@ -1852,7 +1852,7 @@ void game::save_replay()
if(!os->good()) {
ERR_GAME << "Could not save replay! (" << filename << ")" << std::endl;
}
} catch(simple_wml::error& e) {
} catch(const simple_wml::error& e) {
WRN_CONFIG << __func__ << ": simple_wml error: " << e.message << std::endl;
}
}

View file

@ -376,7 +376,7 @@ config server::read_config() const {
read(configuration, *stream);
LOG_SERVER << "Server configuration from file: '" << config_file_
<< "' read.\n";
} catch(config::error& e) {
} catch(const config::error& e) {
ERR_CONFIG << "ERROR: Could not read configuration file: '"
<< config_file_ << "': '" << e.message << "'.\n";
}
@ -1080,7 +1080,7 @@ void server::handle_nickserv(socket_ptr socket, simple_wml::node& nickserv)
"user", player_connections_.find(socket)->info().config_address(), diff);
send_to_lobby(diff);
} catch (user_handler::error& e) {
} catch (const user_handler::error& e) {
send_server_message(socket, "There was an error registering your username. The error message was: "
+ e.message);
}
@ -1101,7 +1101,7 @@ void server::handle_nickserv(socket_ptr socket, simple_wml::node& nickserv)
send_server_message(socket, "Your details have been updated.");
} catch (user_handler::error& e) {
} catch (const user_handler::error& e) {
send_server_message(socket, "There was an error updating your details. The error message was: "
+ e.message);
}
@ -1121,7 +1121,7 @@ void server::handle_nickserv(socket_ptr socket, simple_wml::node& nickserv)
try {
std::string res = user_handler_->user_info((*nickserv.child("info"))["name"].to_string());
send_server_message(socket, res);
} catch (user_handler::error& e) {
} catch (const user_handler::error& e) {
send_server_message(socket, "There was an error looking up the details of the user '" +
(*nickserv.child("info"))["name"].to_string() + "'. " +" The error message was: "
+ e.message);
@ -1156,7 +1156,7 @@ void server::handle_nickserv(socket_ptr socket, simple_wml::node& nickserv)
make_change_diff(games_and_users_list_.root(), nullptr,
"user", player_connections_.find(socket)->info().config_address(), diff);
send_to_lobby(diff);
} catch (user_handler::error& e) {
} catch (const user_handler::error& e) {
send_server_message(socket, "There was an error dropping your username. The error message was: "
+ e.message);
}
@ -2103,7 +2103,7 @@ std::string server::process_command(std::string query, std::string issuer_name)
const cmd_handler &handler = handler_itor->second;
try {
handler(issuer_name, query, parameters, &out);
} catch (std::bad_function_call & ex) {
} catch (const std::bad_function_call & ex) {
ERR_SERVER << "While handling a command '" << command << "', caught a std::bad_function_call exception.\n";
ERR_SERVER << ex.what() << std::endl;
out << "An internal server error occurred (std::bad_function_call) while executing '" << command << "'\n";
@ -2112,7 +2112,7 @@ std::string server::process_command(std::string query, std::string issuer_name)
return out.str();
} catch ( utf8::invalid_utf8_exception & e ) {
} catch (const utf8::invalid_utf8_exception & e ) {
std::string msg = "While handling a command, caught an invalid utf8 exception: ";
msg += e.what();
ERR_SERVER << msg << std::endl;
@ -2412,7 +2412,7 @@ void server::bans_handler(const std::string& /*issuer_name*/, const std::string&
ban_manager_.list_bans(*out, parameters);
}
} catch ( utf8::invalid_utf8_exception & e ) {
} catch (const utf8::invalid_utf8_exception & e ) {
ERR_SERVER << "While handling bans, caught an invalid utf8 exception: " << e.what() << std::endl;
}
}
@ -2759,7 +2759,7 @@ void server::dul_handler(const std::string& /*issuer_name*/, const std::string&
*out << "Unregistered login is now " << (deny_unregistered_login_ ? "disallowed" : "allowed") << ".";
}
} catch ( utf8::invalid_utf8_exception & e ) {
} catch (const utf8::invalid_utf8_exception & e ) {
ERR_SERVER << "While handling dul (deny unregistered logins), caught an invalid utf8 exception: " << e.what() << std::endl;
}
}
@ -2919,7 +2919,7 @@ int main(int argc, char** argv) {
try {
wesnothd::server(port, keep_alive, config_file, min_threads, max_threads).run();
} catch(std::exception& e) {
} catch(const std::exception& e) {
ERR_SERVER << "terminated by C++ exception: " << e.what() << std::endl;
return 1;
}

View file

@ -91,7 +91,7 @@ char* uncompress_buffer(const string_span& input, string_span* span)
*span = string_span(small_out, pos);
state = 8;
return small_out;
} catch (std::bad_alloc& e) {
} catch (const std::bad_alloc& e) {
ERR_SWML << "ERROR: bad_alloc caught in uncompress_buffer() state "
<< state << " alloc bytes " << nalloc << " with input: '"
<< input << "' " << e.what() << std::endl;
@ -144,7 +144,7 @@ char* compress_buffer(const char* input, string_span* span, bool bzip2)
assert(*small_out == (bzip2 ? 'B' : 31));
state = 9;
return small_out;
} catch (std::bad_alloc& e) {
} catch (const std::bad_alloc& e) {
ERR_SWML << "ERROR: bad_alloc caught in compress_buffer() state "
<< state << " alloc bytes " << nalloc << " with input: '"
<< input << "' " << e.what() << std::endl;
@ -1047,7 +1047,7 @@ const char* document::output()
char* buf;
try {
buf = new char[buf_size];
} catch (std::bad_alloc& e) {
} catch (const std::bad_alloc& e) {
ERR_SWML << "ERROR: Trying to allocate " << buf_size << " bytes. "
<< e.what() << std::endl;
throw error("Bad allocation request in output().");

View file

@ -236,7 +236,7 @@ bool side_filter::match_internal(const team &t) const
return false;
}
return true;
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
lg::wml_error() << "Formula error in side filter: " << e.type << " at " << e.filename << ':' << e.line << ")\n";
// Formulae with syntax errors match nothing
return false;

View file

@ -150,7 +150,7 @@ static stats::str_int_map read_str_int_map(const config& cfg)
for(const std::string& val : utils::split(i.second)) {
m[val] = std::stoi(i.first);
}
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_NG << "Invalid statistics entry; skipping\n";
}
}

View file

@ -261,7 +261,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(move, child, use_undo, show, error_handler)
try {
read_locations(child,steps);
} catch (std::invalid_argument&) {
} catch (const std::invalid_argument&) {
WRN_REPLAY << "Warning: Path data contained something which could not be parsed to a sequence of locations:" << "\n config = " << child.debug() << std::endl;
return false;
}
@ -489,7 +489,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_
resources::gameboard->units().erase(loc);
resources::whiteboard->on_kill_unit();
resources::gameboard->units().insert(new_u);
} catch(unit_type::error& e) {
} catch(const unit_type::error& e) {
ERR_REPLAY << e.what() << std::endl; // TODO: more appropriate error message log
return false;
}

View file

@ -466,7 +466,7 @@ bool terrain_builder::load_images(building_rule& rule)
if(items.size() > 1) {
try {
time = std::stoi(items.back());
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_NG << "Invalid 'time' value in terrain image builder: " << items.back() << "\n";
}
}
@ -694,7 +694,7 @@ void terrain_builder::add_images_from_config(rule_imagelist& images, const confi
try {
basex = std::stoi(base[0]);
basey = std::stoi(base[1]);
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_NG << "Invalid 'base' value in terrain image builder: " << base[0] << ", " << base[1] << "\n";
}
}
@ -707,7 +707,7 @@ void terrain_builder::add_images_from_config(rule_imagelist& images, const confi
try {
center_x = std::stoi(center[0]);
center_y = std::stoi(center[1]);
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
ERR_NG << "Invalid 'center' value in terrain image builder: " << center[0] << ", " << center[1]
<< "\n";
}

View file

@ -340,7 +340,7 @@ bool terrain_filter::match_internal(const map_location& loc, const unit* ref_uni
return false;
}
return true;
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
lg::wml_error() << "Formula error in location filter: " << e.type << " at " << e.filename << ':' << e.line << ")\n";
// Formulae with syntax errors match nothing
return false;

View file

@ -751,7 +751,7 @@ static terrain_code string_to_number_(std::string str, std::string& start_positi
if(offset < end) {
try {
start_position = str.substr(begin, offset - begin);
} catch(bad_lexical_cast&) {
} catch(const bad_lexical_cast&) {
return VOID_TERRAIN;
}
begin = offset + 1;

View file

@ -201,15 +201,15 @@ namespace {
std::string exception;
try {
dlg->show(1);
} catch(gui2::layout_exception_width_modified&) {
} catch(const gui2::layout_exception_width_modified&) {
exception = "gui2::layout_exception_width_modified";
} catch(gui2::layout_exception_width_resize_failed&) {
} catch(const gui2::layout_exception_width_resize_failed&) {
exception = "gui2::layout_exception_width_resize_failed";
} catch(gui2::layout_exception_height_resize_failed&) {
} catch(const gui2::layout_exception_height_resize_failed&) {
exception = "gui2::layout_exception_height_resize_failed";
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
exception = e.dev_message;
} catch(std::exception& e) {
} catch(const std::exception& e) {
exception = e.what();
} catch(...) {
exception = "unknown";
@ -243,15 +243,15 @@ namespace {
gui2::window* window = unit_test_window((*dlg.get()));
BOOST_REQUIRE_NE(window, static_cast<void*>(nullptr));
window->draw();
} catch(gui2::layout_exception_width_modified&) {
} catch(const gui2::layout_exception_width_modified&) {
exception = "gui2::layout_exception_width_modified";
} catch(gui2::layout_exception_width_resize_failed&) {
} catch(const gui2::layout_exception_width_resize_failed&) {
exception = "gui2::layout_exception_width_resize_failed";
} catch(gui2::layout_exception_height_resize_failed&) {
} catch(const gui2::layout_exception_height_resize_failed&) {
exception = "gui2::layout_exception_height_resize_failed";
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
exception = e.dev_message;
} catch(std::exception& e) {
} catch(const std::exception& e) {
exception = e.what();
} catch(...) {
exception = "unknown";
@ -287,15 +287,15 @@ namespace {
, "Test message for a tooltip."
, point(0, 0)
, {0,0,0,0});
} catch(gui2::layout_exception_width_modified&) {
} catch(const gui2::layout_exception_width_modified&) {
exception = "gui2::layout_exception_width_modified";
} catch(gui2::layout_exception_width_resize_failed&) {
} catch(const gui2::layout_exception_width_resize_failed&) {
exception = "gui2::layout_exception_width_resize_failed";
} catch(gui2::layout_exception_height_resize_failed&) {
} catch(const gui2::layout_exception_height_resize_failed&) {
exception = "gui2::layout_exception_height_resize_failed";
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
exception = e.dev_message;
} catch(std::exception& e) {
} catch(const std::exception& e) {
exception = e.what();
} catch(...) {
exception = "unknown";
@ -565,7 +565,7 @@ BOOST_AUTO_TEST_CASE(test_make_test_fake)
try {
message dlg("title", "message", true, false, false);
dlg.show(1);
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
BOOST_CHECK(e.user_message == _("Failed to show a dialog, "
"which doesn't fit on the screen."));
return;

View file

@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE ( test_make_enum_namespace )
try {
e = lexical_cast<foo::enumname> ("name3"); //returns con3
} catch (bad_lexical_cast & /*e*/) {
} catch (const bad_lexical_cast & /*e*/) {
//std::cerr << "enum lexical cast didn't work!" << std::endl;
threw_exception_when_it_wasnt_supposed_to = true;
}
@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE ( test_make_enum_namespace )
try {
e = lexical_cast<foo::enumname> ("name4"); //throw bad_lexical_cast
} catch (bad_lexical_cast & /*e*/) {
} catch (const bad_lexical_cast & /*e*/) {
//std::cerr << "enum lexical cast worked!" << std::endl;
threw_exception_when_it_was_supposed_to = true;
}
@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE ( test_make_enum_class )
try {
e = lexical_cast<bar::another> ("name3"); //returns val3
} catch (bad_lexical_cast & /*e*/) {
} catch(const bad_lexical_cast & /*e*/) {
//std::cerr << "enum lexical cast didn't work!" << std::endl;
threw_exception_when_it_wasnt_supposed_to = true;
}
@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE ( test_make_enum_class )
try {
e = lexical_cast<bar::another> ("name4"); //throw bad_lexical_cast
} catch (bad_lexical_cast & /*e*/) {
} catch (const bad_lexical_cast & /*e*/) {
//std::cerr << "enum lexical cast worked!" << std::endl;
threw_exception_when_it_was_supposed_to = true;
}

View file

@ -90,7 +90,7 @@ void tod_manager::resolve_random(randomness::rng& r)
return std::stoi(str);
});
}
catch (std::invalid_argument&)
catch (const std::invalid_argument&)
{
// This happens if the random_start_time string is a boolean.
// Simply ignore the exception.

View file

@ -485,7 +485,7 @@ T get_single_ability_value(const config::attribute_value& v, T def, const map_lo
callable.add("other", wfl::variant(std::make_shared<wfl::unit_callable>(*u_itor)));
}
return formula_handler(wfl::formula(s, new wfl::gamestate_function_symbol_table), callable);
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
lg::wml_error() << "Formula error in ability or weapon special: " << e.type << " at " << e.filename << ':' << e.line << ")\n";
return def;
}

View file

@ -164,7 +164,7 @@ static bool matches_simple_filter(const attack_type & attack, const config & fil
if(!form.evaluate(callable).as_bool()) {
return false;
}
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
lg::wml_error() << "Formula error in weapon filter: " << e.type << " at " << e.filename << ':' << e.line << ")\n";
// Formulae with syntax errors match nothing
return false;

View file

@ -635,7 +635,7 @@ void unit_filter_compound::fill(vconfig cfg)
return false;
}
return true;
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
lg::wml_error() << "Formula error in unit filter: " << e.type << " at " << e.filename << ':' << e.line << ")\n";
// Formulae with syntax errors match nothing
return false;

View file

@ -92,7 +92,7 @@ public:
try {
time = (colon_split.size() > 1) ? std::stoi(colon_split[1]) : time_chunk;
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
//ERR_NG << "Invalid time in unit animation: " << colon_split[1] << "\n";
}
@ -102,7 +102,7 @@ public:
T range1 = (range.size() > 1) ? lexical_cast<T>(range[1]) : range0;
base_data.push_back({{range0, range1}, time});
} catch(bad_lexical_cast&) {}
} catch(const bad_lexical_cast&) {}
}
}
@ -169,7 +169,7 @@ public:
if(second_pass.size() > 1) {
try {
total_specified_time += std::stoi(second_pass[1]);
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
//ERR_NG << "Invalid time in unit animation: " << second_pass[1] << "\n";
}
}
@ -183,7 +183,7 @@ public:
if(second_pass.size() > 1) {
try {
base_data.push_back({std::move(second_pass[0]), std::stoi(second_pass[1])});
} catch(std::invalid_argument&) {
} catch(const std::invalid_argument&) {
//ERR_NG << "Invalid time in unit animation: " << second_pass[1] << "\n";
}
} else {

View file

@ -727,7 +727,7 @@ unit::~unit()
if(itor != units_with_cache.end()) {
units_with_cache.erase(itor);
}
} catch(std::exception & e) {
} catch(const std::exception & e) {
ERR_UT << "Caught exception when destroying unit: " << e.what() << std::endl;
} catch(...) {}
}

View file

@ -169,7 +169,7 @@ config vconfig::get_parsed_config() const
{
res.add_child(name);
}
catch(recursion_error &err) {
catch(const recursion_error &err) {
vconfig_recursion.erase(vname);
WRN_NG << err.message << std::endl;
if(vconfig_recursion.empty()) {

View file

@ -169,7 +169,7 @@ static void encode(const std::string& input_file, const std::string& output_file
ifile.close();
safe_exit(remove(input_file.c_str()));
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
std::cerr << "IO error: " << e.what() << "\n";
}
}
@ -189,7 +189,7 @@ static void decode(const std::string& input_file, const std::string& output_file
ifile.close();
safe_exit(remove(input_file.c_str()));
} catch(filesystem::io_exception& e) {
} catch(const filesystem::io_exception& e) {
std::cerr << "IO error: " << e.what() << "\n";
}
}
@ -232,7 +232,7 @@ static void handle_preprocess_command(const commandline_options& cmdline_opts)
try {
filesystem::scoped_istream stream = filesystem::istream_file(file);
read(cfg, *stream);
} catch(config::error& e) {
} catch(const config::error& e) {
std::cerr << "Caught a config error while parsing file '" << file << "':\n" << e.message << std::endl;
}
@ -1075,40 +1075,40 @@ int main(int argc, char** argv)
const int res = do_gameloop(args);
safe_exit(res);
} catch(boost::program_options::error& e) {
} catch(const boost::program_options::error& e) {
std::cerr << "Error in command line: " << e.what() << '\n';
error_exit(1);
} catch(CVideo::error& e) {
} catch(const CVideo::error& e) {
std::cerr << "Could not initialize video.\n\n" << e.what() << "\n\nExiting.\n";
error_exit(1);
} catch(font::error& e) {
} catch(const font::error& e) {
std::cerr << "Could not initialize fonts.\n\n" << e.what() << "\n\nExiting.\n";
error_exit(1);
} catch(config::error& e) {
} catch(const config::error& e) {
std::cerr << e.message << "\n";
error_exit(1);
} catch(gui::button::error&) {
} catch(const gui::button::error&) {
std::cerr << "Could not create button: Image could not be found\n";
error_exit(1);
} catch(CVideo::quit&) {
} catch(const CVideo::quit&) {
// just means the game should quit
} catch(return_to_play_side_exception&) {
} catch(const return_to_play_side_exception&) {
std::cerr << "caught return_to_play_side_exception, please report this bug (quitting)\n";
} catch(quit_game_exception&) {
} catch(const quit_game_exception&) {
std::cerr << "caught quit_game_exception (quitting)\n";
} catch(wml_exception& e) {
} catch(const wml_exception& e) {
std::cerr << "WML exception:\nUser message: " << e.user_message << "\nDev message: " << e.dev_message << '\n';
error_exit(1);
} catch(wfl::formula_error& e) {
} catch(const wfl::formula_error& e) {
std::cerr << e.what() << "\n\nGame will be aborted.\n";
error_exit(1);
} catch(const sdl::exception& e) {
std::cerr << e.what();
error_exit(1);
} catch(game::error&) {
} catch(const game::error&) {
// A message has already been displayed.
error_exit(1);
} catch(std::bad_alloc&) {
} catch(const std::bad_alloc&) {
std::cerr << "Ran out of memory. Aborted.\n";
error_exit(ENOMEM);
#if !defined(NO_CATCH_AT_GAME_END)
@ -1116,7 +1116,7 @@ int main(int argc, char** argv)
// Try to catch unexpected exceptions.
std::cerr << "Caught general '" << typeid(e).name() << "' exception:\n" << e.what() << std::endl;
error_exit(1);
} catch(std::string& e) {
} catch(const std::string& e) {
std::cerr << "Caught a string thrown as an exception:\n" << e << std::endl;
error_exit(1);
} catch(const char* e) {

View file

@ -231,7 +231,7 @@ void move::execute(bool& success, bool& complete)
try {
events::mouse_handler& mouse_handler = resources::controller->get_mouse_handler_base();
num_steps = mouse_handler.move_unit_along_route(steps, interrupted);
} catch (return_to_play_side_exception&) {
} catch (const return_to_play_side_exception&) {
set_arrow_brightness(ARROW_BRIGHTNESS_STANDARD);
throw; // we rely on the caller to delete this action
}

Some files were not shown because too many files have changed in this diff Show more