-
Notifications
You must be signed in to change notification settings - Fork 18
🐛 [client] Fix update error propagation #126
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
🐛 [client] Fix update error propagation #126
Conversation
client/update.go
Outdated
err = errors.WithMessagef(derr, | ||
"progressing update failed: %v, then discarding update failed", updateErr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = errors.WithMessagef(derr, | |
"progressing update failed: %v, then discarding update failed", updateErr) | |
if derr == nil { | |
return err | |
} | |
return errors.WithMessagef(updateErr, "progressing update failed, then discarding update failed", derr) |
In it's current form, when derr
is nil
, errors.WithMessagef
will also return a nil. So updateErr
will be missed even if it is not nil.
Separated into two returns because, when derr
is nil, the phrase "then discarding update failed" will be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derr cannot be nil there because ; derr != nil {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, i missed that part. Then, it can be as it was before.
However, I think you may have to do errors.Messagef(updateErr..
instead of errors.Messagef(derr..
Because if only the message of updateErr
is included, I think it cannot be retrieved later using errors.As
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Changing the ordering seemed unclean. Instead I do according to your first suggestion, don't change the error, just log derr
. Please have a look.
e436c02
to
015cea1
Compare
LGTM. You will have to rebase to latest dev and then I can approve it. |
Fixes a bug where `updateGeneric` discarded a `PeerRejectedError` and replaced it with a different error. Signed-off-by: Matthias Geihs <matthias@perun.network>
015cea1
to
431fed6
Compare
Fixes a bug where
updateGeneric
discarded aPeerRejectedError
and replaced it with a different error.Signed-off-by: Matthias Geihs matthias@perun.network