Log exception type when doing catch(...).

This commit is contained in:
Pentarctagon 2022-08-25 16:38:50 -05:00 committed by Pentarctagon
parent 0946d8b3f0
commit 72a1c801c0
24 changed files with 73 additions and 24 deletions

View file

@ -160,6 +160,8 @@
<Unit filename="../../src/tstring.cpp" />
<Unit filename="../../src/tstring.hpp" />
<Unit filename="../../src/util.hpp" />
<Unit filename="../../src/utils/general.cpp" />
<Unit filename="../../src/utils/general.hpp" />
<Unit filename="../../src/wesconfig.h" />
<Extensions>
<code_completion />

View file

@ -174,6 +174,8 @@
<Unit filename="../../src/util.hpp" />
<Unit filename="../../src/game_version.cpp" />
<Unit filename="../../src/game_version.hpp" />
<Unit filename="../../src/utils/general.cpp" />
<Unit filename="../../src/utils/general.hpp" />
<Unit filename="../../src/wesconfig.h" />
<Extensions>
<code_completion />

View file

@ -7,6 +7,10 @@
objects = {
/* Begin PBXBuildFile section */
1234567890ABCDEF12345678 /* file_progress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1234567890ABCDEF12345680 /* file_progress.cpp */; };
1234567890ABCDEF12345679 /* file_progress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1234567890ABCDEF12345680 /* file_progress.cpp */; };
36B146FAA79A55E9F43723B1 /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84234C54BB84519421FD4136 /* general.cpp */; };
4291489DA38012477DA3BA7C /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84234C54BB84519421FD4136 /* general.cpp */; };
460CA6D52143362800B89741 /* apple_version.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46F54C26211DFB7200374A1C /* apple_version.mm */; };
460D898624DC7831000B1ABC /* game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460D897824DC7830000B1ABC /* game.cpp */; };
460D898724DC7831000B1ABC /* ban.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460D897C24DC7830000B1ABC /* ban.cpp */; };
@ -323,8 +327,6 @@
46F92DBA2174F6A300602C1C /* help_browser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92C692174F6A300602C1C /* help_browser.cpp */; };
46F92DBB2174F6A300602C1C /* file_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92C6B2174F6A300602C1C /* file_dialog.cpp */; };
46F92DBC2174F6A300602C1C /* file_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92C6B2174F6A300602C1C /* file_dialog.cpp */; };
1234567890ABCDEF12345678 /* file_progress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1234567890ABCDEF12345680 /* file_progress.cpp */; };
1234567890ABCDEF12345679 /* file_progress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1234567890ABCDEF12345680 /* file_progress.cpp */; };
46F92DBD2174F6A300602C1C /* folder_create.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92C6E2174F6A300602C1C /* folder_create.cpp */; };
46F92DBE2174F6A300602C1C /* folder_create.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92C6E2174F6A300602C1C /* folder_create.cpp */; };
46F92DBF2174F6A300602C1C /* language_selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92C6F2174F6A300602C1C /* language_selection.cpp */; };
@ -588,6 +590,7 @@
46F92F272175036700602C1C /* constants.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92F0E2174FEC000602C1C /* constants.cpp */; };
4944F41B1354FBFF0027E614 /* teleport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4944F41A1354FBFF0027E614 /* teleport.cpp */; };
49478714172FF6F8002B7ABA /* tristate_button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49478712172FF6F8002B7ABA /* tristate_button.cpp */; };
508C40A885166B2E3F4245F4 /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84234C54BB84519421FD4136 /* general.cpp */; };
620A386E15E9364E00A4F513 /* attack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 620A386215E9364E00A4F513 /* attack.cpp */; };
620A386F15E9364E00A4F513 /* create.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 620A386415E9364E00A4F513 /* create.cpp */; };
620A387015E9364F00A4F513 /* heal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 620A386615E9364E00A4F513 /* heal.cpp */; };
@ -1384,6 +1387,7 @@
F4D5483E15198D060058C8A7 /* lua_jailbreak_exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F419E44413354E620031448A /* lua_jailbreak_exception.cpp */; };
F4E4E0B11367241E001C7528 /* suppose_dead.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4E4E0AF1367241E001C7528 /* suppose_dead.cpp */; };
F4E4E0B41367244F001C7528 /* image_modifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4E4E0B21367244F001C7528 /* image_modifications.cpp */; };
F6E34C7CBC418F214B43BC39 /* general.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84234C54BB84519421FD4136 /* general.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -1490,6 +1494,8 @@
/* Begin PBXFileReference section */
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
1234567890ABCDEF12345680 /* file_progress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_progress.cpp; sourceTree = "<group>"; };
1234567890ABCDEF12345681 /* file_progress.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = file_progress.hpp; sourceTree = "<group>"; };
1C58BBDF21822A930078D25A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
460D897824DC7830000B1ABC /* game.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = game.cpp; path = ../../src/server/wesnothd/game.cpp; sourceTree = SOURCE_ROOT; };
460D897924DC7830000B1ABC /* ban.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ban.hpp; path = ../../src/server/wesnothd/ban.hpp; sourceTree = SOURCE_ROOT; };
@ -1733,7 +1739,6 @@
46F92C692174F6A300602C1C /* help_browser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = help_browser.cpp; sourceTree = "<group>"; };
46F92C6A2174F6A300602C1C /* title_screen.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = title_screen.hpp; sourceTree = "<group>"; };
46F92C6B2174F6A300602C1C /* file_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_dialog.cpp; sourceTree = "<group>"; };
1234567890ABCDEF12345680 /* file_progress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_progress.cpp; sourceTree = "<group>"; };
46F92C6C2174F6A300602C1C /* attack_predictions.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = attack_predictions.hpp; sourceTree = "<group>"; };
46F92C6D2174F6A300602C1C /* tooltip.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = tooltip.hpp; sourceTree = "<group>"; };
46F92C6E2174F6A300602C1C /* folder_create.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = folder_create.cpp; sourceTree = "<group>"; };
@ -1759,7 +1764,6 @@
46F92C822174F6A300602C1C /* unit_recruit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unit_recruit.cpp; sourceTree = "<group>"; };
46F92C832174F6A300602C1C /* edit_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = edit_text.cpp; sourceTree = "<group>"; };
46F92C842174F6A300602C1C /* file_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = file_dialog.hpp; sourceTree = "<group>"; };
1234567890ABCDEF12345681 /* file_progress.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = file_progress.hpp; sourceTree = "<group>"; };
46F92C852174F6A300602C1C /* attack_predictions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = attack_predictions.cpp; sourceTree = "<group>"; };
46F92C862174F6A300602C1C /* tooltip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tooltip.cpp; sourceTree = "<group>"; };
46F92C872174F6A300602C1C /* title_screen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = title_screen.cpp; sourceTree = "<group>"; };
@ -2109,6 +2113,7 @@
62D24F311519987400350848 /* context_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = context_manager.cpp; sourceTree = "<group>"; };
62D24F331519994300350848 /* palette_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = palette_manager.hpp; sourceTree = "<group>"; };
62D24F341519995200350848 /* palette_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = palette_manager.cpp; sourceTree = "<group>"; };
84234C54BB84519421FD4136 /* general.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = general.cpp; path = general.cpp; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* The Battle for Wesnoth.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "The Battle for Wesnoth.app"; sourceTree = BUILT_PRODUCTS_DIR; };
903F959B1ED5489500F1BDD3 /* credentials.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = credentials.cpp; path = preferences/credentials.cpp; sourceTree = "<group>"; };
@ -4333,6 +4338,7 @@
4675F093257A495A00ADF791 /* scope_exit.hpp */,
469CA216253C52120045A0B3 /* shared_reference.hpp */,
9197972A26199FB5001E8133 /* variant.hpp */,
84234C54BB84519421FD4136 /* general.cpp */,
);
path = utils;
sourceTree = "<group>";
@ -5705,6 +5711,7 @@
915C68EA1DF1DCB000594B07 /* color.cpp in Sources */,
46F92E232174F6A400602C1C /* lobby.cpp in Sources */,
46F92E212174F6A400602C1C /* mp_change_control.cpp in Sources */,
36B146FAA79A55E9F43723B1 /* general.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -5788,6 +5795,7 @@
915C68F21DF1F5C600594B07 /* color.cpp in Sources */,
46F92F272175036700602C1C /* constants.cpp in Sources */,
46685CAB219D640E0009CFFE /* string_utils.cpp in Sources */,
508C40A885166B2E3F4245F4 /* general.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -6364,6 +6372,7 @@
46F92DAC2174F6A300602C1C /* unit_recall.cpp in Sources */,
46F92C172174F5D700602C1C /* help_browser.cpp in Sources */,
915C68EC1DF1DCB000594B07 /* color.cpp in Sources */,
4291489DA38012477DA3BA7C /* general.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -6411,6 +6420,7 @@
46685CA2219D52FA0009CFFE /* unicode.cpp in Sources */,
B5BB6C790F89426400444FBF /* game_version.cpp in Sources */,
915C68EB1DF1DCB000594B07 /* color.cpp in Sources */,
F6E34C7CBC418F214B43BC39 /* general.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View file

@ -23,6 +23,7 @@
#include "log.hpp"
#include "preferences/general.hpp"
#include "serialization/unicode.hpp"
#include "utils/general.hpp"
#if !defined(_WIN32) && !defined(__APPLE__)
#include <boost/filesystem.hpp>
@ -118,7 +119,7 @@ void enumerate_storage_devices(std::vector<path_info>& res)
catch(...) {
//bool is_empty(const path& p, system::error_code& ec) might throw.
//For example if you have no permission on that directory. Don't list the file in that case.
DBG_DU << "caught exception in enumerate_storage_devices";
DBG_DU << "caught exception " << utils::get_unknown_exception_type() << " in enumerate_storage_devices";
}
}

View file

@ -20,6 +20,7 @@
#include "gui/core/top_level_drawable.hpp"
#include "preferences/general.hpp"
#include "sdl/rect.hpp"
#include "utils/general.hpp"
#include "video.hpp"
#include <SDL2/SDL_rect.h>
@ -250,8 +251,8 @@ next:
try {
drawn |= tld->expose(i);
} catch(...) {
WRN_DM << "exception thrown during expose "
<< static_cast<void*>(tld);
WRN_DM << "exception " << utils::get_unknown_exception_type()
<< " thrown during expose " << static_cast<void*>(tld);
drawing_ = false;
throw;
}

View file

@ -22,6 +22,7 @@
#include "quit_confirmation.hpp"
#include "sdl/userevent.hpp"
#include "utils/ranges.hpp"
#include "utils/general.hpp"
#include "video.hpp"
#if defined _WIN32
@ -46,6 +47,7 @@ static lg::log_domain log_display("display");
static lg::log_domain log_event("event");
#define LOG_EV LOG_STREAM(info, log_event)
#define DBG_EV LOG_STREAM(debug, log_event)
namespace
{
@ -71,6 +73,7 @@ struct invoked_function_data
// Handle this exception in the main thread.
throw;
} catch(...) {
DBG_EV << "Caught exception in invoked function: " << utils::get_unknown_exception_type();
finished.set_exception(std::current_exception());
return;
}

View file

@ -29,6 +29,7 @@
#include "serialization/string_utils.hpp"
#include "serialization/unicode.hpp"
#include "serialization/unicode_cast.hpp"
#include "utils/general.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
@ -169,7 +170,7 @@ public:
try {
customcodecvt_do_conversion<char, wchar_t>(state, from, from_end, from_next, to, to_end, to_next);
} catch(...) {
ERR_FS << "Invalid UTF-8 string'" << std::string(from, from_end) << "' ";
ERR_FS << "Invalid UTF-8 string'" << std::string(from, from_end) << "' with exception: " << utils::get_unknown_exception_type();
return std::codecvt_base::error;
}
@ -187,7 +188,7 @@ public:
try {
customcodecvt_do_conversion<wchar_t, char>(state, from, from_end, from_next, to, to_end, to_next);
} catch(...) {
ERR_FS << "Invalid UTF-16 string";
ERR_FS << "Invalid UTF-16 string with exception: " << utils::get_unknown_exception_type();
return std::codecvt_base::error;
}

View file

@ -633,6 +633,7 @@ void variant::serialize_from_string(const std::string& str)
try {
*this = formula(str).evaluate();
} catch(...) {
DBG_SF << "Evaluation failed with exception: " << utils::get_unknown_exception_type();
*this = variant(str);
}
}

View file

@ -20,6 +20,7 @@
#include "preferences/game.hpp"
#include "recall_list_manager.hpp"
#include "units/unit.hpp"
#include "utils/general.hpp"
#include <set>
#include <vector>
@ -434,6 +435,7 @@ temporary_unit_placer::~temporary_unit_placer()
m_.insert(temp_);
}
} catch(...) {
DBG_RG << "Caught exception in temporary_unit_placer destructor: " << utils::get_unknown_exception_type();
}
}
@ -458,6 +460,7 @@ temporary_unit_remover::~temporary_unit_remover()
m_.insert(temp_);
}
} catch(...) {
DBG_RG << "Caught exception in temporary_unit_remover destructor: " << utils::get_unknown_exception_type();
}
}
@ -539,5 +542,6 @@ temporary_unit_mover::~temporary_unit_mover()
m_.insert(temp_);
}
} catch(...) {
DBG_RG << "Caught exception in temporary_unit_mover destructor: " << utils::get_unknown_exception_type();
}
}

View file

@ -43,12 +43,14 @@
#include "synced_context.hpp"
#include "units/unit.hpp"
#include "units/drawer.hpp"
#include "utils/general.hpp"
#include "whiteboard/manager.hpp"
#include "overlay.hpp"
static lg::log_domain log_display("display");
#define ERR_DP LOG_STREAM(err, log_display)
#define LOG_DP LOG_STREAM(info, log_display)
#define DBG_DP LOG_STREAM(debug, log_display)
static lg::log_domain log_engine("engine");
#define ERR_NG LOG_STREAM(err, log_engine)
@ -86,6 +88,7 @@ game_display::~game_display()
try {
chat_man_->prune_chat_messages(true);
} catch(...) {
DBG_DP << "Caught exception in game_display destructor: " << utils::get_unknown_exception_type();
}
}

View file

@ -1074,9 +1074,8 @@ game_launcher::~game_launcher()
sound::close_sound();
video::deinit();
} catch(std::exception& e) {
ERR_GENERAL << "Suppressing exception thrown during ~game_launcher: "
<< e.what();
ERR_GENERAL << "Suppressing exception thrown during ~game_launcher: " << e.what();
} catch(...) {
ERR_GENERAL << "Suppressing exception thrown during ~game_launcher";
ERR_GENERAL << "Suppressing exception " << utils::get_unknown_exception_type() << " thrown during ~game_launcher";
}
}

View file

@ -598,6 +598,7 @@ int window::show(const unsigned auto_close_timeout)
catch(...)
{
// TODO: is this even necessary? What are we catching?
DBG_DP << "Caught general exception in show(): " << utils::get_unknown_exception_type();
hide();
throw;
}

View file

@ -2117,7 +2117,7 @@ void menu_handler::do_ai_formula(const std::string& str, int side_num, mouse_han
add_chat_message(std::time(nullptr), "wfl", 0, ai::manager::get_singleton().evaluate_command(side_num, str));
} catch(const wfl::formula_error&) {
} catch(...) {
add_chat_message(std::time(nullptr), "wfl", 0, "UNKNOWN ERROR IN FORMULA");
add_chat_message(std::time(nullptr), "wfl", 0, "UNKNOWN ERROR IN FORMULA: "+utils::get_unknown_exception_type());
}
}

View file

@ -193,6 +193,7 @@ play_controller::play_controller(const config& level, saved_game& state_of_game,
try {
init(level);
} catch(...) {
DBG_NG << "Caught exception initializing level: " << utils::get_unknown_exception_type();
clear_resources();
throw;
}

View file

@ -41,6 +41,7 @@
static lg::log_domain log_engine("engine");
#define LOG_NG LOG_STREAM(info, log_engine)
#define DBG_NG LOG_STREAM(debug, log_engine)
playmp_controller::playmp_controller(const config& level, saved_game& state_of_game, mp_game_metadata* mp_info)
: playsingle_controller(level, state_of_game, mp_info && mp_info->skip_replay)
@ -68,6 +69,7 @@ playmp_controller::~playmp_controller()
try {
turn_data_.host_transfer().detach_handler(this);
} catch(...) {
DBG_NG << "Caught exception in playmp_controller destructor: " << utils::get_unknown_exception_type();
}
}
@ -181,6 +183,7 @@ void playmp_controller::play_human_turn()
}
}
} catch(...) {
DBG_NG << "Caught exception while playing a side: " << utils::get_unknown_exception_type();
turn_data_.send_data();
throw;
}
@ -201,6 +204,7 @@ void playmp_controller::play_idle_loop()
play_slice_catch();
SDL_Delay(1);
} catch(...) {
DBG_NG << "Caught exception while playing idle loop: " << utils::get_unknown_exception_type();
turn_data_.send_data();
throw;
}

View file

@ -62,6 +62,7 @@ static lg::log_domain log_aitesting("ai/testing");
static lg::log_domain log_engine("engine");
#define ERR_NG LOG_STREAM(err, log_engine)
#define LOG_NG LOG_STREAM(info, log_engine)
#define DBG_NG LOG_STREAM(debug, log_engine)
static lg::log_domain log_enginerefac("enginerefac");
#define LOG_RG LOG_STREAM(info, log_enginerefac)
@ -599,6 +600,7 @@ void playsingle_controller::play_ai_turn()
ai_fallback_ = true;
}
} catch(...) {
DBG_NG << "Caught exception playing ai turn: " << utils::get_unknown_exception_type();
turn_data_.sync_network();
throw;
}

View file

@ -14,12 +14,14 @@
#include "playturn_network_adapter.hpp"
#include "log.hpp"
#include "utils/general.hpp"
#include <functional>
#include <cassert>
static lg::log_domain log_network("network");
#define DBG_NW LOG_STREAM(debug, log_network)
#define LOG_NW LOG_STREAM(info, log_network)
#define ERR_NW LOG_STREAM(err, log_network)
@ -36,7 +38,8 @@ void playturn_network_adapter::read_from_network()
}
catch(...)
{
//Readin from network can throw, we want to ignore the possibly corrupt packet in this case.
//Reading from network can throw, we want to ignore the possibly corrupt packet in this case.
DBG_NW << "Caught exception reading from the network: " << utils::get_unknown_exception_type();
this->data_.pop_back();
throw;
}

View file

@ -24,6 +24,7 @@
#include "server/common/simple_wml.hpp"
#include "log.hpp"
#include "utils/general.hpp"
static lg::log_domain log_config("config");
#define ERR_SWML LOG_STREAM(err, log_config)
@ -996,6 +997,7 @@ document::document(string_span compressed_buf) :
try {
root_ = new node(*this, nullptr, &cbuf);
} catch(...) {
ERR_SWML << "Caught exception creating a new simple_wml node: " << utils::get_unknown_exception_type();
delete [] buffers_.front();
buffers_.clear();
throw;

View file

@ -21,6 +21,7 @@
#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/unicode.hpp"
#include "utils/general.hpp"
#include "server/wesnothd/ban.hpp"
@ -715,6 +716,7 @@ ban_manager::~ban_manager()
try {
write();
} catch(...) {
DBG_SERVER << "Caught exception in ban_manager destructor: " << utils::get_unknown_exception_type();
}
}

View file

@ -130,6 +130,7 @@ game::~game()
} catch(const boost::coroutines::detail::forced_unwind&) {
ERR_GAME << "Caught forced_unwind in game destructor!";
} catch(...) {
ERR_GAME << "Caught other exception in game destructor: " << utils::get_unknown_exception_type();
}
}

View file

@ -117,12 +117,13 @@
#include "serialization/string_utils.hpp"
#include "terrain/type_data.hpp"
#include "tests/utils/fake_display.hpp"
#include <functional>
#include "utils/general.hpp"
#include "wesnothd_connection.hpp"
#include "wml_exception.hpp"
#include <boost/test/unit_test.hpp>
#include <functional>
#include <memory>
using namespace gui2::dialogs;
@ -215,7 +216,7 @@ namespace {
} catch(const std::exception& e) {
exception = e.what();
} catch(...) {
exception = "unknown";
exception = utils::get_unknown_exception_type();
}
BOOST_CHECK_MESSAGE(exception.empty(),
"Test for '" << id
@ -262,7 +263,7 @@ namespace {
} catch(const std::exception& e) {
exception = e.what();
} catch(...) {
exception = "unknown";
exception = utils::get_unknown_exception_type();
}
BOOST_CHECK_MESSAGE(exception.empty(),
"Test for '" << id
@ -306,7 +307,7 @@ namespace {
} catch(const std::exception& e) {
exception = e.what();
} catch(...) {
exception = "unknown";
exception = utils::get_unknown_exception_type();
}
BOOST_CHECK_MESSAGE(exception.empty(),
"Test for tip '" << id
@ -676,12 +677,12 @@ BOOST_AUTO_TEST_CASE(test_make_test_fake)
message dlg("title", "message", true, false, false);
dlg.show(1);
} catch(const wml_exception& e) {
BOOST_CHECK(e.user_message == _("Failed to show a dialog, "
"which doesn't fit on the screen."));
BOOST_CHECK(e.user_message == _("Failed to show a dialog, which doesn't fit on the screen."));
return;
} catch(...) {
BOOST_ERROR("Didn't catch the wanted exception, instead caught " << utils::get_unknown_exception_type() << ".");
}
BOOST_ERROR("Didn't catch the wanted exception.");
BOOST_ERROR("Didn't catch the wanted exception, instead caught nothing.");
}
BOOST_AUTO_TEST_SUITE_END()

View file

@ -720,7 +720,9 @@ unit::~unit()
}
} catch(const std::exception & e) {
ERR_UT << "Caught exception when destroying unit: " << e.what();
} catch(...) {}
} catch(...) {
DBG_UT << "Caught general exception when destroying unit: " << utils::get_unknown_exception_type();
}
}
/**
@ -2584,7 +2586,9 @@ unit_movement_resetter::~unit_movement_resetter()
}
u_.set_movement(moves_);
} catch(...) {}
} catch(...) {
DBG_UT << "Caught exception when destroying unit_movement_resetter: " << utils::get_unknown_exception_type();
}
}
std::string unit::TC_image_mods() const

View file

@ -1183,7 +1183,7 @@ int main(int argc, char** argv)
// is caught and all destructors are actually called. (Apparently,
// some compilers will simply terminate without calling destructors if
// the exception isn't caught.)
PLAIN_LOG << "Caught unspecified general exception. Terminating.";
PLAIN_LOG << "Caught general exception " << utils::get_unknown_exception_type() << ". Terminating.";
error_exit(1);
#endif
}

View file

@ -108,6 +108,7 @@ wesnothd_connection::wesnothd_connection(const std::string& host, const std::str
// Handshake already complete. Do nothing.
}
} catch(...) {
DBG_NW << "wesnothd_connection worker thread threw general exception: " << utils::get_unknown_exception_type();
}
LOG_NW << "wesnothd_connection::io_service::run() returned";