mirror of
https://github.com/restic/restic.git
synced 2024-12-22 07:43:03 +00:00
Merge pull request #3270 from restic/fix-ls-json
ls: Check for non-nil error before calling panic()
This commit is contained in:
commit
917f5b910a
1 changed files with 6 additions and 2 deletions
|
@ -165,7 +165,9 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||
ShortID: sn.ID().Str(),
|
||||
StructType: "snapshot",
|
||||
})
|
||||
panic(err)
|
||||
if err != nil {
|
||||
Warnf("JSON encode failed: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
printNode = func(path string, node *restic.Node) {
|
||||
|
@ -182,7 +184,9 @@ func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
|
|||
ChangeTime: node.ChangeTime,
|
||||
StructType: "node",
|
||||
})
|
||||
panic(err)
|
||||
if err != nil {
|
||||
Warnf("JSON encode failed: %v\n", err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printSnapshot = func(sn *restic.Snapshot) {
|
||||
|
|
Loading…
Reference in a new issue