mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
Merge pull request #4454 from ipfs/fix/get-error-4452
Fix error handling in commands add and get
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user