mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 23:06:32 +00:00
ls: Check for non-nil error before calling panic()
This commit is contained in:
parent
9985368d46
commit
c0f2c1d871
@ -165,7 +165,9 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||||||
ShortID: sn.ID().Str(),
|
ShortID: sn.ID().Str(),
|
||||||
StructType: "snapshot",
|
StructType: "snapshot",
|
||||||
})
|
})
|
||||||
panic(err)
|
if err != nil {
|
||||||
|
Warnf("JSON encode failed: %v\n", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printNode = func(path string, node *restic.Node) {
|
printNode = func(path string, node *restic.Node) {
|
||||||
@ -182,7 +184,9 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||||||
ChangeTime: node.ChangeTime,
|
ChangeTime: node.ChangeTime,
|
||||||
StructType: "node",
|
StructType: "node",
|
||||||
})
|
})
|
||||||
panic(err)
|
if err != nil {
|
||||||
|
Warnf("JSON encode failed: %v\n", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printSnapshot = func(sn *restic.Snapshot) {
|
printSnapshot = func(sn *restic.Snapshot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user