You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a library that unfortunately does logger[metadataKey: "request.error"] = .string(error.localizedDescription) where the error is an error out of AHC. The result is that it always prints
request.error=The operation couldn’t be completed. (AsyncHTTPClient.HTTPClientError error 1.)
Note that error 1 is produced regardless of the actual error.
The source of the problem is this oddity in Swift/Foundation:
import Foundation
struct MyError: Error & CustomStringConvertible { var description: String { "hello" } }
print((MyError() as Error).localizedDescription)
// produces: "The operation couldn’t be completed. (MyError error 1.)"
The text was updated successfully, but these errors were encountered:
weissi
changed the title
AHC errors have bad .localizedDescription
AHC errors have bad .localizedDescription (always claims error 1)
Dec 18, 2024
I'm using a library that unfortunately does
logger[metadataKey: "request.error"] = .string(error.localizedDescription)
where theerror
is an error out of AHC. The result is that it always printsNote that
error 1
is produced regardless of the actual error.The source of the problem is this oddity in Swift/Foundation:
The text was updated successfully, but these errors were encountered: