-
Notifications
You must be signed in to change notification settings - Fork 881
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 about bridgeSetup #2215
Conversation
drivers/bridge/bridge.go
Outdated
@@ -735,7 +735,11 @@ func (d *driver) createNetwork(config *networkConfiguration) error { | |||
|
|||
// Apply the prepared list of steps, and abort at the first error. | |||
bridgeSetup.queueStep(setupDeviceUp) | |||
return bridgeSetup.apply() | |||
if err = bridgeSetup.apply(); err != 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.
would be better if you change the method prototype like this:
func (d *driver) createNetwork(config *networkConfiguration) (err error) {
and remove line 618
that way we are sure that if the body of this function has a return the defer is still being honored
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.
If we were going that route I'd probably suggest something less generic than err
. It's almost idiomatic to shadow it.
Thanks @hzue, I left a comment on the patch |
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.
LGTM -- hate these types of errors!
Fix the error from bridgeSetup doesn't handle by the defer function in the createNetwork function. Signed-off-by: Terry Chu <jubosh.tw@gmail.com>
Hi @fcrisciani @ctelfer, thanks for your advice. |
Still LGTM. |
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.
LGTM
Thanks @hzue |
Fix the error from bridgeSetup doesn't handle by the defer function in the createNetwork function.
Signed-off-by: Terry Chu jubosh.tw@gmail.com