diff --git a/imports.md b/imports.md index e08b326..dbca06e 100644 --- a/imports.md +++ b/imports.md @@ -2,11 +2,33 @@
wasi:io/error
wasi:io/poll
wasi:io/streams
resource error
[method]error.to-debug-string: func
Returns a string that is suitable to assist humans in debugging +this error.
+WARNING: The returned string should not be consumed mechanically! +It may change across platforms, hosts, or other implementation +details. Parsing this string is a major platform-compatibility +hazard.
+A poll API intended to let users wait for I/O events on multiple handles at once.
@@ -64,11 +86,13 @@ stream types. when it does, they are expected to subsume this API.type pollable
type error
+#### `type pollable` +[`pollable`](#pollable)
-#### `resource error` -
variant stream-error
An error for input-stream and output-stream operations.
resource output-stream
[method]error.to-debug-string: func
Returns a string that's suitable to assist humans in debugging this -error.
-The returned string will change across platforms and hosts which -means that parsing it, for example, would be a -platform-compatibility hazard.
-[method]input-stream.read: func
Perform a non-blocking read from the stream.
This function returns a list of bytes containing the read data,
diff --git a/wit/error.wit b/wit/error.wit
new file mode 100644
index 0000000..66519ef
--- /dev/null
+++ b/wit/error.wit
@@ -0,0 +1,34 @@
+package wasi:io;
+
+
+interface error {
+ /// A resource which represents some error information.
+ ///
+ /// The only method provided by this resource is `to-debug-string`,
+ /// which provides some human-readable information about the error.
+ ///
+ /// In the `wasi:io` package, this resource is returned through the
+ /// `wasi:io/streams/stream-error` type.
+ ///
+ /// To provide more specific error information, other interfaces may
+ /// provide functions to further "downcast" this error into more specific
+ /// error information. For example, `error`s returned in streams derived
+ /// from filesystem types to be described using the filesystem's own
+ /// error-code type, using the function
+ /// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
+ /// `borrow