Add more error checks

This commit is contained in:
Alexander Neumann
2021-01-30 17:25:10 +01:00
parent cbd88c457a
commit 200f09522d
11 changed files with 63 additions and 24 deletions
+4 -2
View File
@@ -159,16 +159,17 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
enc := json.NewEncoder(gopts.stdout)
printSnapshot = func(sn *restic.Snapshot) {
enc.Encode(lsSnapshot{
err = enc.Encode(lsSnapshot{
Snapshot: sn,
ID: sn.ID(),
ShortID: sn.ID().Str(),
StructType: "snapshot",
})
panic(err)
}
printNode = func(path string, node *restic.Node) {
enc.Encode(lsNode{
err = enc.Encode(lsNode{
Name: node.Name,
Type: node.Type,
Path: path,
@@ -181,6 +182,7 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
ChangeTime: node.ChangeTime,
StructType: "node",
})
panic(err)
}
} else {
printSnapshot = func(sn *restic.Snapshot) {