Skip to content

Improve unexpected response error handling in resolver#6617

Merged
estesp merged 2 commits intocontainerd:mainfrom
FabHof:main
Mar 8, 2022
Merged

Improve unexpected response error handling in resolver#6617
estesp merged 2 commits intocontainerd:mainfrom
FabHof:main

Conversation

@FabHof
Copy link
Copy Markdown
Contributor

@FabHof FabHof commented Mar 4, 2022

No description provided.

@k8s-ci-robot
Copy link
Copy Markdown

Hi @FabHof. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

Signed-off-by: Fabian Hoffmann <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Mar 4, 2022

Build succeeded.

  • containerd-build-arm64 : RETRY_LIMIT in 4m 07s (non-voting)
  • containerd-test-arm64 : RETRY_LIMIT in 6m 38s (non-voting)
  • containerd-integration-test-arm64 : RETRY_LIMIT in 24m 46s (non-voting)

@estesp
Copy link
Copy Markdown
Member

estesp commented Mar 4, 2022

The default string format of the UnexpectedStatusError holds less information than these formulated errors being replaced (status only, vs. status, host, and path currently) even though clearly the error struct has more data; don't know if anyone relies on the current response contents?

@kzys
Copy link
Copy Markdown
Member

kzys commented Mar 4, 2022

I'd like to avoid reducing information on the errors. It is useful for troubleshooting.

@FabHof
Copy link
Copy Markdown
Contributor Author

FabHof commented Mar 7, 2022

I would expect errors.As(err, myUnexpectedResponse) to work with every function that can have an unexpected http response. I really don't like relying on stings.

Maybe this improved default error string is better?

func (e ErrUnexpectedStatus) Error() string {
-	return fmt.Sprintf("unexpected status: %s", e.Status)
+	return fmt.Sprintf("unexpected status from %s request to %s: %s", e.RequestMethod, e.RequestURL, e.Status)
}

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Mar 7, 2022

Build succeeded.

  • containerd-build-arm64 : RETRY_LIMIT in 3m 47s (non-voting)
  • containerd-test-arm64 : RETRY_LIMIT in 6m 03s (non-voting)
  • containerd-integration-test-arm64 : RETRY_LIMIT in 24m 55s (non-voting)

Copy link
Copy Markdown
Member

@kzys kzys left a comment

Choose a reason for hiding this comment

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

LGTM

/ok-to-test

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants