summaryrefslogtreecommitdiff
path: root/test/read_conf.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/read_conf.cxx')
-rw-r--r--test/read_conf.cxx13
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;