-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move error resource to its own interface.
Two reasons for this design change: * it is confusing having one type named `stream/stream-error` and another named `stream/error`. * this error resource seems useful outside of just streams. Therefore, we are moving it to a separate interface `error` in the same package. There are no functional changes to this type. The doc comments are now more general.
- Loading branch information
Pat Hickey
committed
Nov 10, 2023
1 parent
ee24d1f
commit 4792310
Showing
2 changed files
with
60 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<error>` and returns | ||
/// `option<wasi:filesystem/types/error-code>`. | ||
/// | ||
/// The set of functions which can "downcast" an `error` into a more | ||
/// concrete type is open. | ||
resource error { | ||
/// 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. | ||
to-debug-string: func() -> string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters