From 8e46a5c771fb16043c51f12568c4a3b7f42e60b2 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 12 Mar 2025 08:18:04 +0100 Subject: [PATCH] - improved error messages --- client/snbk/BackupConfig.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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); -- 2.47.3