diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 22:08:08 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 22:08:08 +0200 |
commit | 428c2ec0e35492ef218862e432afb0e6ceed68c6 (patch) | |
tree | b42686a1c4836d975ac3ffc8f6f1bbc02a886b31 /test | |
parent | 1a82981d07dbf37507a75e93d980cf559f497bbd (diff) |
test/read_conf: throw if setting is not configured
Diffstat (limited to 'test')
-rw-r--r-- | test/read_conf.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/test/read_conf.cxx b/test/read_conf.cxx index 4fc52a842..e2b290b72 100644 --- a/test/read_conf.cxx +++ b/test/read_conf.cxx @@ -47,17 +47,12 @@ try { ReadConfigFile(config_path); const char *value = config_get_string(option); - int ret; - if (value != NULL) { - printf("%s\n", value); - ret = EXIT_SUCCESS; - } else { - fprintf(stderr, "No such setting: %s\n", name); - ret = EXIT_FAILURE; - } + if (value == nullptr) + throw FormatRuntimeError("No such setting: %s", name); + printf("%s\n", value); config_global_finish(); - return ret; + return EXIT_SUCCESS; } catch (...) { PrintException(std::current_exception()); return EXIT_FAILURE; |