Skip to content

Commit bf7ebfa

Browse files
haesbaertVexu
authored andcommitted
Handle all errors on std.net.Ipv4address.resolveIP
The following test fails since NonCanonical is not handled test "foo" { std.net.Ip4Address.resolveIp("1.1.1.1", 0) catch unreachable; } /usr/lib/zig/std/net.zig:240:60: error: switch must handle all possibilities if (parse(name, port)) |ip4| return ip4 else |err| switch (err) { ^~~~~~ /usr/lib/zig/std/net.zig:240:60: note: unhandled error value: 'error.NonCanonical' referenced by: test.foo: src/dhcp.zig:383:23
1 parent 2e7d28d commit bf7ebfa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/std/net.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ pub const Ip4Address = extern struct {
264264
error.InvalidEnd,
265265
error.InvalidCharacter,
266266
error.Incomplete,
267+
error.NonCanonical,
267268
=> {},
268269
}
269270
return error.InvalidIPAddressFormat;

0 commit comments

Comments
 (0)