Skip to content

Give HTTPClientError meaningful localized descriptions - #920

Open
thliu21 wants to merge 1 commit into
swift-server:mainfrom
thliu21:agent/async-http-client-797-localized-description
Open

thliu21 wants to merge 1 commit into
swift-server:mainfrom
thliu21:agent/async-http-client-797-localized-description

Conversation

@thliu21

@thliu21 thliu21 commented Aug 31, 2026

Copy link
Copy Markdown

Motivation

HTTPClientError.localizedDescription currently falls back to Foundation’s generic error 1 message, which hides the underlying AsyncHTTPClient failure.

Fixes #797.

Modifications

  • Conform HTTPClientError to LocalizedError in the Foundation extensions layer.
  • Return its existing full description from errorDescription.
  • Add regression coverage for errors with and without associated values.

Result

localizedDescription now reports the concrete HTTP client error and preserves diagnostic associated values.

Testing

  • swift test --explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors --filter FoundationExtensionTests
  • swift test

Motivation:

HTTPClientError.localizedDescription currently falls back to Foundation’s generic error 1 message, obscuring the underlying failure.

Modifications:

Conform HTTPClientError to LocalizedError using its existing description and add coverage for errors with and without associated values.

Result:

localizedDescription now preserves the concrete HTTP client error details.

This branch has not been deployed

No deployments
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.

AHC errors have bad .localizedDescription (always claims error 1)

1 participant