Skip to content

Conversation

@helayoty
Copy link
Member

  • In GetACISubnet function, the response error is not handled by errors.As(err, &respErr), which will cause nil pointer dereference when the response error is nil.

  • runtime.WithCaptureResponse is deprecated in favor of policy.WithCaptureResponse

@helayoty helayoty requested a review from Copilot June 25, 2025 01:37
@helayoty helayoty requested a review from Fei-Guo as a code owner June 25, 2025 01:37
@helayoty helayoty added the kind/bug Something isn't working label Jun 25, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces deprecated runtime.WithCaptureResponse with policy.WithCaptureResponse and adds guards against nil response errors to prevent panics.

  • Swap runtime.WithCaptureResponse for policy.WithCaptureResponse in two packages
  • In GetACISubnet, guard respErr.RawResponse against nil before checking status
  • Update error checks in client APIs to use errors.As (though some checks are misapplied)

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/network/aci_network.go Replaced capture helper and added nil guard on respErr.RawResponse
pkg/client/client_apis.go Replaced capture helper and modified 404 checks using errors.As

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants