Skip to content

Commit

Permalink
Merge pull request #4454 from ipfs/fix/get-error-4452
Browse files Browse the repository at this point in the history
Fix error handling in commands add and get
  • Loading branch information
whyrusleeping authored Dec 4, 2017
2 parents 39f0f5f + 6f82f08 commit bee2ba3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
15 changes: 2 additions & 13 deletions core/commands/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,8 @@ You can now check what blocks have been created by:

for {
v, err := res.Next()
if err != nil {
// replace error by actual error - will be looked at by next if-statement
if err == cmds.ErrRcvdError {
err = res.Error()
}

if e, ok := err.(*cmdkit.Error); ok {
re.Emit(e)
} else if err != io.EOF {
re.SetError(err, cmdkit.ErrNormal)
}

return
if !cmds.HandleError(err, res, re) {
break
}

select {
Expand Down
3 changes: 1 addition & 2 deletions core/commands/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ may also specify the level of compression by specifying '-l=<1-9>'.
defer re.Close()

v, err := res.Next()
if err != nil {
log.Error(e.New(err))
if !cmds.HandleError(err, res, re) {
return
}

Expand Down

0 comments on commit bee2ba3

Please sign in to comment.