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
replace error type assertions with errors.As() in the destroy
module
#3971
Conversation
/label platform/openstack |
destroy
module
/lgtm |
@@ -224,7 +224,8 @@ func deleteServers(opts *clientconfig.ClientOpts, filter Filter, logger logrus.F | |||
err = servers.Delete(conn, server.ID).ExtractErr() | |||
if err != nil { | |||
// Ignore the error if the server cannot be found and return with an appropriate message if it's another type of error | |||
if _, ok := err.(gophercloud.ErrDefault404); !ok { | |||
var gerr gophercloud.ErrDefault404 | |||
if !errors.As(err, &gerr) { |
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.
Since you are not using gerr here in the if block, isn't it better to use errors.Is
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.
@abhinavdahiya
Afaik, errors.Is checks if two errors are equal (i.e. err == gerr), but gophercloud generates new errors of ErrDefault404
type for each request. It means that we have to compare their types (ErrDefault404 or not ErrDefault404).
If you know how I can use errors.Is here, please tell me.
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 you think As as is more appropiate, please explain that in the commit message. i'm fine as long as the reasoning is described.
/test e2e-aws-upgrade |
can we define var gerr gophercloud.ErrDefault404 as a constant |
lets do it post ff |
I'm not sure what you mean. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pierreprinetti The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
7 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@Fedosin: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
No description provided.