mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
std-docs: improve error message on write failure
This commit is contained in:
parent
4fcdb08390
commit
ce4e8a991f
1 changed files with 13 additions and 3 deletions
|
|
@ -106,9 +106,19 @@ fn accept(context: *Context, connection: std.net.Server.Connection) void {
|
|||
return;
|
||||
},
|
||||
};
|
||||
serveRequest(&request, context) catch |err| {
|
||||
std.log.err("unable to serve {s}: {s}", .{ request.head.target, @errorName(err) });
|
||||
return;
|
||||
serveRequest(&request, context) catch |err| switch (err) {
|
||||
error.WriteFailed => {
|
||||
if (conn_writer.err) |e| {
|
||||
std.log.err("unable to serve {s}: {s}", .{ request.head.target, @errorName(e) });
|
||||
} else {
|
||||
std.log.err("unable to serve {s}: {s}", .{ request.head.target, @errorName(err) });
|
||||
}
|
||||
return;
|
||||
},
|
||||
else => {
|
||||
std.log.err("unable to serve {s}: {s}", .{ request.head.target, @errorName(err) });
|
||||
return;
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue