From 55cea675a3139710876f702faee986f589bcdc1b Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Tue, 10 Mar 2026 22:11:41 +0100 Subject: [PATCH] Use the same `other` error code convention as other WASi interfaces. Relates to: https://github.com/WebAssembly/WASI/issues/892 --- .../sockets/wit-0.3.0-draft/ip-name-lookup.wit | 13 ++++++------- proposals/sockets/wit-0.3.0-draft/types.wit | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/proposals/sockets/wit-0.3.0-draft/ip-name-lookup.wit b/proposals/sockets/wit-0.3.0-draft/ip-name-lookup.wit index a234eef4..8e6bcfa8 100644 --- a/proposals/sockets/wit-0.3.0-draft/ip-name-lookup.wit +++ b/proposals/sockets/wit-0.3.0-draft/ip-name-lookup.wit @@ -5,13 +5,7 @@ interface ip-name-lookup { /// Lookup error codes. @since(version = 0.3.0-rc-2026-02-09) - enum error-code { - /// Unknown error - /// - /// This is an escape hatch for WASI implementations to handle failures - /// that can not be categorized under any of the other error codes. - unknown, - + variant error-code { /// Access denied. /// /// POSIX equivalent: EACCES, EPERM @@ -36,6 +30,11 @@ interface ip-name-lookup { /// /// POSIX equivalent: EAI_FAIL permanent-resolver-failure, + + /// A catch-all for errors not captured by the existing variants. + /// Implementations can use this to extend the error type without + /// breaking existing code. + other(option), } /// Resolve an internet host name to a list of IP addresses. diff --git a/proposals/sockets/wit-0.3.0-draft/types.wit b/proposals/sockets/wit-0.3.0-draft/types.wit index 9cb8299b..c6725efe 100644 --- a/proposals/sockets/wit-0.3.0-draft/types.wit +++ b/proposals/sockets/wit-0.3.0-draft/types.wit @@ -15,13 +15,7 @@ interface types { /// /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. @since(version = 0.3.0-rc-2026-02-09) - enum error-code { - /// Unknown error. - /// - /// This is an escape hatch for WASI implementations to handle failures - /// that can not be categorized under any of the other error codes. - unknown, - + variant error-code { /// Access denied. /// /// POSIX equivalent: EACCES, EPERM @@ -91,6 +85,11 @@ interface types { /// /// POSIX equivalent: EMSGSIZE datagram-too-large, + + /// A catch-all for errors not captured by the existing variants. + /// Implementations can use this to extend the error type without + /// breaking existing code. + other(option), } @since(version = 0.3.0-rc-2026-02-09)