Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-merkledag
Commits
ef322f3c
Commit
ef322f3c
authored
Nov 17, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment multiple dagstore error checking
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
7cb580ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
utils/utils.go
utils/utils.go
+4
-0
No files found.
utils/utils.go
View file @
ef322f3c
...
@@ -98,9 +98,12 @@ func (e *Editor) insertNodeAtPath(ctx context.Context, root *dag.Node, path []st
...
@@ -98,9 +98,12 @@ func (e *Editor) insertNodeAtPath(ctx context.Context, root *dag.Node, path []st
nd
=
create
()
nd
=
create
()
err
=
nil
// no longer an error case
err
=
nil
// no longer an error case
}
else
if
err
==
dag
.
ErrNotFound
{
}
else
if
err
==
dag
.
ErrNotFound
{
// try finding it in our source dagstore
nd
,
err
=
root
.
GetLinkedNode
(
ctx
,
e
.
src
,
path
[
0
])
nd
,
err
=
root
.
GetLinkedNode
(
ctx
,
e
.
src
,
path
[
0
])
}
}
// if we receive an ErrNotFound, then our second 'GetLinkedNode' call
// also fails, we want to error out
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -153,6 +156,7 @@ func (e *Editor) rmLink(ctx context.Context, root *dag.Node, path []string) (*da
...
@@ -153,6 +156,7 @@ func (e *Editor) rmLink(ctx context.Context, root *dag.Node, path []string) (*da
return
root
,
nil
return
root
,
nil
}
}
// search for node in both tmp dagstore and source dagstore
nd
,
err
:=
root
.
GetLinkedNode
(
ctx
,
e
.
tmp
,
path
[
0
])
nd
,
err
:=
root
.
GetLinkedNode
(
ctx
,
e
.
tmp
,
path
[
0
])
if
err
==
dag
.
ErrNotFound
{
if
err
==
dag
.
ErrNotFound
{
nd
,
err
=
root
.
GetLinkedNode
(
ctx
,
e
.
src
,
path
[
0
])
nd
,
err
=
root
.
GetLinkedNode
(
ctx
,
e
.
src
,
path
[
0
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment