aboutsummaryrefslogtreecommitdiff
path: root/zenserver/config.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-22 11:28:54 +0200
committerStefan Boberg <[email protected]>2021-09-22 11:28:54 +0200
commitaa970be35b31c0fcf5647449712f6bf1eb880670 (patch)
tree29eccde5dd7d18426e22d5a9e3fcb849b5139f68 /zenserver/config.cpp
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-aa970be35b31c0fcf5647449712f6bf1eb880670.tar.xz
zen-aa970be35b31c0fcf5647449712f6bf1eb880670.zip
Added lua config script syntax error handling.
I originally expected this to throw but it does not so we have to handle that case ourselves. Currently does not include source location but we will add that at a later time.
Diffstat (limited to 'zenserver/config.cpp')
-rw-r--r--zenserver/config.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index af28168a5..1a24bba0d 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -278,6 +278,14 @@ ParseServiceConfig(const std::filesystem::path& DataRoot, ZenServiceConfig& Serv
try
{
sol::load_result config = lua.load(std::string_view((const char*)LuaScript.Data(), LuaScript.Size()), "zencfg");
+
+ if (config.status() != sol::load_status::ok)
+ {
+ std::string ErrorString = sol::to_string(config.status());
+
+ throw std::runtime_error("lua '{}' error"_format(ErrorString));
+ }
+
config();
}
catch (std::exception& e)