Skip to content

Conversation

@j2rong4cn
Copy link
Member

错误的使用errors.Unwrap errors.Unwrap并没有fallback机制

Copy link
Contributor

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 fixes an issue where HttpStatusCode couldn't be properly passed through error unwrapping by replacing errors.Unwrap with a custom errs.UnwrapOrSelf function that provides fallback behavior.

Key changes:

  • Introduces a new UnwrapOrSelf function that returns the original error if unwrapping fails
  • Replaces three instances of errors.Unwrap with the new fallback mechanism in HTTP serving logic

Reviewed Changes

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

File Description
internal/net/serve.go Updated error unwrapping calls to use the new fallback mechanism for proper HTTP status code extraction
internal/errs/unwrap.go Added new utility function that provides fallback behavior when unwrapping errors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: j2rong4cn <36783515+j2rong4cn@users.noreply.github.com>
@j2rong4cn
Copy link
Member Author

var ErrExceedMaxConcurrency = HttpStatusCodeError(http.StatusTooManyRequests)

@j2rong4cn j2rong4cn merged commit da0c734 into OpenListTeam:main Sep 30, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants