fix: Handle uncaught exceptions more gracefully

This commit is contained in:
WerWolv
2025-08-30 14:24:39 +02:00
parent a9d45d837f
commit e1079d751a
2 changed files with 11 additions and 7 deletions

View File

@@ -274,8 +274,12 @@ namespace hex::init {
// Run all exit tasks, and print to console
void runExitTasks() {
for (const auto &[name, task, async, running] : init::getExitTasks()) {
const bool result = task();
log::info("Exit task '{0}' finished {1}", name, result ? "successfully" : "unsuccessfully");
try {
const bool result = task();
log::info("Exit task '{0}' finished {1}", name, result ? "successfully" : "unsuccessfully");
} catch (const std::exception &e) {
log::error("Exit task '{}' failed with exception: {}", name, e.what());
}
}
}