Skip to content

Commit 5a4a587

Browse files
authored
Update Server.zig:{listen, do} to specify error enums
1 parent 41a4908 commit 5a4a587

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/std/http/Server.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ pub const Response = struct {
393393
pub const DoError = Connection.WriteError || error{ UnsupportedTransferEncoding, InvalidContentLength };
394394

395395
/// Send the response headers.
396-
pub fn do(res: *Response) !void {
396+
pub fn do(res: *Response) DoError!void {
397397
switch (res.state) {
398398
.waited => res.state = .responded,
399399
.first, .start, .responded, .finished => unreachable,
@@ -668,7 +668,7 @@ pub fn deinit(server: *Server) void {
668668
pub const ListenError = std.os.SocketError || std.os.BindError || std.os.ListenError || std.os.SetSockOptError || std.os.GetSockNameError;
669669

670670
/// Start the HTTP server listening on the given address.
671-
pub fn listen(server: *Server, address: net.Address) !void {
671+
pub fn listen(server: *Server, address: net.Address) ListenError!void {
672672
try server.socket.listen(address);
673673
}
674674

0 commit comments

Comments
 (0)