Skip to content

Commit

Permalink
Hashable SocketAddressError (#3119)
Browse files Browse the repository at this point in the history
Make `SocketAddressError` `Equatable` and `Hashable`. This is useful when running tests
that you expect to throw this error as it allows you to write for
example
```swift
await #expect(throws: SocketAddressError.unknown(host: "127.0.0.1", port: Int.max)) {
    try await app.startup()
}
```
  • Loading branch information
0xTim authored Feb 23, 2025
1 parent 5f60cee commit 6c44e2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/NIOCore/SocketAddresses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import WASILibc
#endif

/// Special `Error` that may be thrown if we fail to create a `SocketAddress`.
public enum SocketAddressError: Error {
public enum SocketAddressError: Error, Equatable, Hashable {
/// The host is unknown (could not be resolved).
case unknown(host: String, port: Int)
/// The requested `SocketAddress` is not supported.
Expand Down

0 comments on commit 6c44e2d

Please sign in to comment.