Skip to content

Commit 55cea67

Browse files
committed
Use the same other error code convention as other WASi interfaces.
Relates to: #892
1 parent d2eef34 commit 55cea67

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

proposals/sockets/wit-0.3.0-draft/ip-name-lookup.wit

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ interface ip-name-lookup {
55

66
/// Lookup error codes.
77
@since(version = 0.3.0-rc-2026-02-09)
8-
enum error-code {
9-
/// Unknown error
10-
///
11-
/// This is an escape hatch for WASI implementations to handle failures
12-
/// that can not be categorized under any of the other error codes.
13-
unknown,
14-
8+
variant error-code {
159
/// Access denied.
1610
///
1711
/// POSIX equivalent: EACCES, EPERM
@@ -36,6 +30,11 @@ interface ip-name-lookup {
3630
///
3731
/// POSIX equivalent: EAI_FAIL
3832
permanent-resolver-failure,
33+
34+
/// A catch-all for errors not captured by the existing variants.
35+
/// Implementations can use this to extend the error type without
36+
/// breaking existing code.
37+
other(option<string>),
3938
}
4039

4140
/// Resolve an internet host name to a list of IP addresses.

proposals/sockets/wit-0.3.0-draft/types.wit

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@ interface types {
1515
///
1616
/// See each individual API for what the POSIX equivalents are. They sometimes differ per API.
1717
@since(version = 0.3.0-rc-2026-02-09)
18-
enum error-code {
19-
/// Unknown error.
20-
///
21-
/// This is an escape hatch for WASI implementations to handle failures
22-
/// that can not be categorized under any of the other error codes.
23-
unknown,
24-
18+
variant error-code {
2519
/// Access denied.
2620
///
2721
/// POSIX equivalent: EACCES, EPERM
@@ -91,6 +85,11 @@ interface types {
9185
///
9286
/// POSIX equivalent: EMSGSIZE
9387
datagram-too-large,
88+
89+
/// A catch-all for errors not captured by the existing variants.
90+
/// Implementations can use this to extend the error type without
91+
/// breaking existing code.
92+
other(option<string>),
9493
}
9594

9695
@since(version = 0.3.0-rc-2026-02-09)

0 commit comments

Comments
 (0)