-
Notifications
You must be signed in to change notification settings - Fork 726
Make ChannelError and NIOConnectionError conform to CustomStringConvertible #3230
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
Changes from 3 commits
7d4223f
4100539
2e80317
ad8e3c4
0f10bc6
8fc62bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -70,6 +70,28 @@ public struct NIOConnectionError: Error { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| extension NIOConnectionError: CustomStringConvertible { | ||||||
| public var description: String { | ||||||
| if let dnsError = (dnsAError ?? dnsAAAAError) { | ||||||
| return "DNS error: \(dnsError.localizedDescription)" | ||||||
|
||||||
| return "DNS error: \(dnsError.localizedDescription)" | |
| return "DNS error: \(dnsError)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - updated.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do any casting here and avoid using localizedDescription. Just use String(describing: $0) here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - updated.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can still hint that it's a connection error: e.g. "NIOConnectionError: unknown"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: coding style in NIO is to use explicit
self:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - updated.