Skip to content

[SR-13037] some corelibs-foundation URLError convenience accessors don't work #3249

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

Closed
glessard opened this issue Jun 17, 2020 · 1 comment
Closed
Assignees

Comments

@glessard
Copy link
Contributor

Previous ID SR-13037
Radar None
Original Reporter @glessard
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Ubuntu 18.04

Swift version 5.2.4 (swift-5.2.4-RELEASE)

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @glessard
Priority Medium

md5: 57eb840c13458f7b3cb0d95663c2417f

Issue Description:

The `URLError.failingURL` and `URLError.failureURLString` don't work on corelibs-foundation.

let url = URL(string: "https://swift.org")!
let e = URLError(.cancelled, userInfo: [
  NSURLErrorFailingURLErrorKey: url,
  NSURLErrorFailingURLStringErrorKey: url.absoluteString
])

print(e.failingURL?.absoluteString ?? "none")
print(e.failureURLString ?? "none")

print((e.userInfo[NSURLErrorFailingURLErrorKey] as? URL)?.absoluteString ?? "none")
print(e.userInfo[NSURLErrorFailingURLStringErrorKey] as? String ?? "none")

prints:

none
none
https://swift.org
https://swift.org

Needless to say, the output on macOS is "https://swift.org" four times.

@glessard
Copy link
Contributor Author

Fixed in #2828

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from swiftlang/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant