Also catch exception thrown by executeCode.
return;
}
- g_included = true;
struct stat st;
if (stat(dirname.c_str(), &st)) {
errlog("The included directory %s does not exist!", dirname.c_str());
closedir(dirp);
files.sort();
+ g_included = true;
+
for (auto file = files.begin(); file != files.end(); ++file) {
std::ifstream ifs(*file);
if (!ifs) {
vinfolog("Read configuration from '%s'", *file);
}
- luaCtx.executeCode(ifs);
+ try {
+ luaCtx.executeCode(ifs);
+ }
+ catch (...) {
+ g_included = false;
+ throw;
+ }
}
g_included = false;