Skip to content

Commit 9af1ed3

Browse files
committed
Deprecate redundant error type ConnectError
The two error types look like this, side by side: ```zig pub const RequestError = ConnectTcpError || error{ UnsupportedUriScheme, UriMissingHost, UriHostTooLong, CertificateBundleLoadFailure, }; pub const ConnectError = ConnectTcpError || RequestError; ``` Once evaluated, then end up containing the exact same error types, so it is redundant to have them both. I chose to keep `RequestError` because it is used slightly more and also so the `Client.request()` method gets an error return type that matches the name of the method.
1 parent fecd95f commit 9af1ed3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/std/http/Client.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ pub const Request = struct {
10631063
try w.writeAll("\r\n");
10641064
}
10651065

1066-
pub const ReceiveHeadError = http.Reader.HeadError || ConnectError || error{
1066+
pub const ReceiveHeadError = http.Reader.HeadError || RequestError || error{
10671067
/// Server sent headers that did not conform to the HTTP protocol.
10681068
///
10691069
/// To find out more detailed diagnostics, `http.Reader.head_buffer` can be
@@ -1562,7 +1562,8 @@ pub fn connectProxied(
15621562
};
15631563
}
15641564

1565-
pub const ConnectError = ConnectTcpError || RequestError;
1565+
/// Deprecated. Please use `RequestError` instead.
1566+
pub const ConnectError = RequestError;
15661567

15671568
/// Connect to `host:port` using the specified protocol. This will reuse a
15681569
/// connection if one is already open.

0 commit comments

Comments
 (0)