Skip to content

Commit

Permalink
fix pack.assemble & app.reconfig_packs/app.config_packs missing packs…
Browse files Browse the repository at this point in the history
… non-informative error messages
  • Loading branch information
MihailRis committed Jan 26, 2025
1 parent ac3b3e8 commit e03467c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/logic/scripting/lua/libs/libcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ static int l_reconfig_packs(lua::State* L) {
lua::pop(L);
}
auto engineController = engine->getController();
engineController->reconfigPacks(controller, addPacks, remPacks);
try {
engineController->reconfigPacks(controller, addPacks, remPacks);
} catch (const contentpack_error& err) {
throw std::runtime_error(
std::string(err.what()) + " [" + err.getPackId() + " ]"
);
}
return 0;
}

Expand Down
8 changes: 7 additions & 1 deletion src/logic/scripting/lua/libs/libpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ static int l_pack_assemble(lua::State* L) {
}
auto manager = engine->createPacksManager(worldFolder);
manager.scan();
ids = std::move(manager.assemble(ids));
try {
ids = std::move(manager.assemble(ids));
} catch (const contentpack_error& err) {
throw std::runtime_error(
std::string(err.what()) + " [" + err.getPackId() + "]"
);
}

lua::createtable(L, ids.size(), 0);
for (size_t i = 0; i < ids.size(); i++) {
Expand Down

0 comments on commit e03467c

Please sign in to comment.