comment multiple dagstore error checking
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Nov 17, 2015 at 10:17 UTC
5e99be98997f72545dca424770e1c47664440a08
1 file changed
+4
merkledag/utils/utils.go
+4
@@ -98,9 +98,12 @@ func (e *Editor) insertNodeAtPath(ctx context.Context, root *dag.Node, path []st
98
nd = create()
99
err = nil // no longer an error case
100
} else if err == dag.ErrNotFound {
101
+ // try finding it in our source dagstore
102
nd, err = root.GetLinkedNode(ctx, e.src, path[0])
103
}
104
105
+ // if we receive an ErrNotFound, then our second 'GetLinkedNode' call
106
+ // also fails, we want to error out
107
if err != nil {
108
return nil, err
109
}
@@ -153,6 +156,7 @@ func (e *Editor) rmLink(ctx context.Context, root *dag.Node, path []string) (*da
156
return root, nil
157
}
158
159
+ // search for node in both tmp dagstore and source dagstore
160
nd, err := root.GetLinkedNode(ctx, e.tmp, path[0])
161
if err == dag.ErrNotFound {
162
nd, err = root.GetLinkedNode(ctx, e.src, path[0])