mirror of
https://github.com/PixlOne/logiops.git
synced 2025-07-14 05:12:34 +08:00
logid: Fail on invalid Configurations
NixOS will soon have a runtime test for logiops which uses an invalid configuration as a baseline, expecting it to fail. Silent errors are not nice for users; systemd does not inform users of stderr messages in nominally running services. https://github.com/NixOS/nixpkgs/pull/167388
This commit is contained in:
parent
dbe2b28a53
commit
5741a9a323
@ -34,11 +34,11 @@ Configuration::Configuration(const std::string& config_file)
|
||||
} catch(const FileIOException &e) {
|
||||
logPrintf(ERROR, "I/O Error while reading %s: %s", config_file.c_str(),
|
||||
e.what());
|
||||
throw e;
|
||||
exit(EXIT_FAILURE);
|
||||
} catch(const ParseException &e) {
|
||||
logPrintf(ERROR, "Parse error in %s, line %d: %s", e.getFile(),
|
||||
e.getLine(), e.getError());
|
||||
throw e;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
const Setting &root = _config.getRoot();
|
||||
|
@ -168,7 +168,8 @@ int main(int argc, char** argv)
|
||||
global_config = std::make_shared<Configuration>(options.config_file);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
global_config = std::make_shared<Configuration>();
|
||||
logPrintf(ERROR, "%s", e.what());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
global_workqueue = std::make_shared<workqueue>(
|
||||
global_config->workerCount());
|
||||
|
Loading…
Reference in New Issue
Block a user