Unverified Commit bee2ba38 authored by Whyrusleeping's avatar Whyrusleeping Committed by GitHub

Merge pull request #4454 from ipfs/fix/get-error-4452

Fix error handling in commands add and get
parents 39f0f5f7 6f82f086
......@@ -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 {
......
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment