From: Arvin Schnell Date: Wed, 12 Mar 2025 07:18:04 +0000 (+0100) Subject: - improved error messages X-Git-Tag: v0.12.2~18^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F993%2Fhead;p=thirdparty%2Fsnapper.git - improved error messages --- diff --git a/client/snbk/BackupConfig.cc b/client/snbk/BackupConfig.cc index b55df94a..1d89a5ee 100644 --- a/client/snbk/BackupConfig.cc +++ b/client/snbk/BackupConfig.cc @@ -44,26 +44,26 @@ namespace snapper JsonFile json_file(BACKUP_CONFIGS_DIR "/" + name + ".json"); if (!get_child_value(json_file.get_root(), "config", config)) - SN_THROW(Exception("config entry not found in file")); + SN_THROW(Exception(sformat("config entry not found in '%s'", name.c_str()))); string tmp1; if (!get_child_value(json_file.get_root(), "target-mode", tmp1)) - SN_THROW(Exception("target-mode entry not found in file")); + SN_THROW(Exception(sformat("target-mode entry not found in '%s'", name.c_str()))); if (!toValue(tmp1, target_mode, false)) - SN_THROW(Exception("unknown target-mode")); + SN_THROW(Exception(sformat("unknown target-mode '%s' in '%s'", tmp1.c_str(), name.c_str()))); if (!get_child_value(json_file.get_root(), "source-path", source_path)) - SN_THROW(Exception("source-path entry not found in file")); + SN_THROW(Exception(sformat("source-path entry not found in '%s'", name.c_str()))); if (!get_child_value(json_file.get_root(), "target-path", target_path)) - SN_THROW(Exception("target-path entry not found in file")); + SN_THROW(Exception(sformat("target-path entry not found in '%s'", name.c_str()))); get_child_value(json_file.get_root(), "automatic", automatic); if (target_mode == TargetMode::SSH_PUSH) { if (!get_child_value(json_file.get_root(), "ssh-host", ssh_host)) - SN_THROW(Exception("ssh-host entry not found in file")); + SN_THROW(Exception(sformat("ssh-host entry not found in '%s'", name.c_str()))); get_child_value(json_file.get_root(), "ssh-port", ssh_port); get_child_value(json_file.get_root(), "ssh-user", ssh_user);