zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bf7ebfa67af78da3ad40869cc61aecb594f9fc74 (tree)
parent 2e7d28dd0d27d94945ac5f131d7f7b4e03bc0024
Author: Christiano Haesbaert <haesbaert@haesbaert.org>
Date:   Fri, 16 Jun 2023 09:04:48 +0200

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

Diffstat:
Mlib/std/net.zig | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/lib/std/net.zig b/lib/std/net.zig @@ -264,6 +264,7 @@ pub const Ip4Address = extern struct { error.InvalidEnd, error.InvalidCharacter, error.Incomplete, + error.NonCanonical, => {}, } return error.InvalidIPAddressFormat;