diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 22:12:51 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 22:12:51 -0600 |
commit | 5626918663de1d3f606850e25a5b39f940ceb7a2 (patch) | |
tree | c15d6b037078106cfa87192bbefedb944e5e466b /cmd/btrfs-fsck/main.go | |
parent | 7b8cdb995ecce81e4603a31e3304f6a2b9401c4c (diff) |
better error handling
Diffstat (limited to 'cmd/btrfs-fsck/main.go')
-rw-r--r-- | cmd/btrfs-fsck/main.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/btrfs-fsck/main.go b/cmd/btrfs-fsck/main.go index e1a37ab..7823c8d 100644 --- a/cmd/btrfs-fsck/main.go +++ b/cmd/btrfs-fsck/main.go @@ -57,9 +57,14 @@ func Main(imgfilename string) (err error) { fmt.Printf("Pass 1: ... walking chunk tree\n") visitedChunkNodes := make(map[btrfs.LogicalAddr]struct{}) if err := fs.WalkTree(superblock.Data.ChunkTree, btrfs.WalkTreeHandler{ - MidNode: func(node *util.Ref[btrfs.LogicalAddr, btrfs.Node]) error { - visitedChunkNodes[node.Addr] = struct{}{} - return nil + Node: func(node *util.Ref[btrfs.LogicalAddr, btrfs.Node], err error) error { + if err != nil { + fmt.Printf("Pass 1: ... walk chunk tree: error: %v\n", err) + } + if node != nil { + visitedChunkNodes[node.Addr] = struct{}{} + } + return err }, }); err != nil { fmt.Printf("Pass 1: ... walk chunk tree: error: %v\n", err) |