From 5a4a5875dc49dd4e027b17b96dd1348822806e58 Mon Sep 17 00:00:00 2001 From: Becker A Date: Fri, 6 Oct 2023 17:47:19 -0600 Subject: [PATCH] Update Server.zig:{listen, do} to specify error enums --- lib/std/http/Server.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/http/Server.zig b/lib/std/http/Server.zig index 04bdfe39b7..a0c4774e06 100644 --- a/lib/std/http/Server.zig +++ b/lib/std/http/Server.zig @@ -393,7 +393,7 @@ pub const Response = struct { pub const DoError = Connection.WriteError || error{ UnsupportedTransferEncoding, InvalidContentLength }; /// Send the response headers. - pub fn do(res: *Response) !void { + pub fn do(res: *Response) DoError!void { switch (res.state) { .waited => res.state = .responded, .first, .start, .responded, .finished => unreachable, @@ -668,7 +668,7 @@ pub fn deinit(server: *Server) void { pub const ListenError = std.os.SocketError || std.os.BindError || std.os.ListenError || std.os.SetSockOptError || std.os.GetSockNameError; /// Start the HTTP server listening on the given address. -pub fn listen(server: *Server, address: net.Address) !void { +pub fn listen(server: *Server, address: net.Address) ListenError!void { try server.socket.listen(address); }