mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-10-24 07:15:51 +00:00
chore: add error handling for fastfile bind
This commit is contained in:
@@ -5,8 +5,26 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
void LoadFastFile(webview::webview& wv, std::string id, std::string path) // NOLINT(performance-unnecessary-value-param) Copy is made for thread safety
|
||||
{
|
||||
ModManContext::Get().m_db_thread.Dispatch(
|
||||
[&wv, id, path]
|
||||
{
|
||||
const auto maybeZone = ModManContext::Get().m_fast_file.LoadFastFile(path);
|
||||
|
||||
}
|
||||
if (maybeZone)
|
||||
{
|
||||
ui::PromiseResolve(wv, id, true);
|
||||
con::debug("Loaded zone \"{}\"", maybeZone.value()->m_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
con::warn("Failed to load zone \"{}\"", path);
|
||||
ui::PromiseReject(wv, id, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace ui
|
||||
{
|
||||
@@ -16,13 +34,7 @@ namespace ui
|
||||
"loadFastFile",
|
||||
[&wv](const std::string& id, std::string path)
|
||||
{
|
||||
std::string idMove(id);
|
||||
ModManContext::Get().m_db_thread.Dispatch(
|
||||
[&wv, idMove, path]
|
||||
{
|
||||
ModManContext::Get().m_fast_file.LoadFastFile(path);
|
||||
PromiseResolve(wv, idMove, true);
|
||||
});
|
||||
LoadFastFile(wv, id, std::move(path));
|
||||
});
|
||||
}
|
||||
} // namespace ui
|
||||
|
||||
Reference in New Issue
Block a user