Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit b7f6de0

Browse files
committed
fix: correctly handle return errors
1 parent 98e2622 commit b7f6de0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

importer/helpers/dagbuilder.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,10 @@ func (db *DagBuilderHelper) FillNodeLayer(node *FSNodeOverDag) error {
189189
return err
190190
}
191191
}
192-
node.Commit()
193192
// TODO: Do we need to commit here? The caller who created the
194193
// `FSNodeOverDag` should be in charge of that.
195-
196-
return nil
194+
_, err := node.Commit()
195+
return err
197196
}
198197

199198
// NewLeafDataNode builds the `node` with the data obtained from the

io/directory.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ func NewDirectoryFromNode(dserv ipld.DAGService, node ipld.Node) (Directory, err
164164

165165
func (d *BasicDirectory) computeEstimatedSize() {
166166
d.estimatedSize = 0
167-
d.ForEachLink(context.TODO(), func(l *ipld.Link) error {
167+
// err is just breaking the iteration and we always return nil
168+
_ = d.ForEachLink(context.TODO(), func(l *ipld.Link) error {
168169
d.addToEstimatedSize(l.Name, l.Cid)
169170
return nil
170171
})
@@ -570,7 +571,7 @@ func (d *DynamicDirectory) AddChild(ctx context.Context, name string, nd ipld.No
570571
if err != nil {
571572
return err
572573
}
573-
hamtDir.AddChild(ctx, name, nd)
574+
err = hamtDir.AddChild(ctx, name, nd)
574575
if err != nil {
575576
return err
576577
}
@@ -600,7 +601,7 @@ func (d *DynamicDirectory) RemoveChild(ctx context.Context, name string) error {
600601
if err != nil {
601602
return err
602603
}
603-
basicDir.RemoveChild(ctx, name)
604+
err = basicDir.RemoveChild(ctx, name)
604605
if err != nil {
605606
return err
606607
}

0 commit comments

Comments
 (0)