test/read_conf: throw if setting is not configured
This commit is contained in:
@@ -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;
|
||||||
|
Reference in New Issue
Block a user