Commit 428c2ec0 authored by Max Kellermann's avatar Max Kellermann

test/read_conf: throw if setting is not configured

parent 1a82981d
...@@ -47,17 +47,12 @@ try { ...@@ -47,17 +47,12 @@ try {
ReadConfigFile(config_path); ReadConfigFile(config_path);
const char *value = config_get_string(option); const char *value = config_get_string(option);
int ret; if (value == nullptr)
if (value != NULL) { throw FormatRuntimeError("No such setting: %s", name);
printf("%s\n", value);
ret = EXIT_SUCCESS;
} else {
fprintf(stderr, "No such setting: %s\n", name);
ret = EXIT_FAILURE;
}
printf("%s\n", value);
config_global_finish(); config_global_finish();
return ret; return EXIT_SUCCESS;
} catch (...) { } catch (...) {
PrintException(std::current_exception()); PrintException(std::current_exception());
return EXIT_FAILURE; return EXIT_FAILURE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment