]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- improved error messages 993/head
authorArvin Schnell <aschnell@suse.de>
Wed, 12 Mar 2025 07:18:04 +0000 (08:18 +0100)
committerArvin Schnell <aschnell@suse.de>
Wed, 12 Mar 2025 07:18:04 +0000 (08:18 +0100)
client/snbk/BackupConfig.cc

index b55df94a1ee60b1478c86bbc8017558dcedad8d3..1d89a5ee7048d8ceaf1e6ee6114d0ae30c84b6c6 100644 (file)
@@ -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);