Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error handling in commands add and get #4454

Merged
merged 1 commit into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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