| 1 |
package wasi:[email protected]; |
| 2 |
|
| 3 |
@since(version = 0.2.0) |
| 4 |
interface error { |
| 5 |
/// A resource which represents some error information. |
| 6 |
/// |
| 7 |
/// The only method provided by this resource is `to-debug-string`, |
| 8 |
/// which provides some human-readable information about the error. |
| 9 |
/// |
| 10 |
/// In the `wasi:io` package, this resource is returned through the |
| 11 |
/// `wasi:io/streams/stream-error` type. |
| 12 |
/// |
| 13 |
/// To provide more specific error information, other interfaces may |
| 14 |
/// offer functions to "downcast" this error into more specific types. For example, |
| 15 |
/// errors returned from streams derived from filesystem types can be described using |
| 16 |
/// the filesystem's own error-code type. This is done using the function |
| 17 |
/// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>` |
| 18 |
/// parameter and returns an `option<wasi:filesystem/types/error-code>`. |
| 19 |
/// |
| 20 |
/// The set of functions which can "downcast" an `error` into a more |
| 21 |
/// concrete type is open. |
| 22 |
@since(version = 0.2.0) |
| 23 |
resource error { |
| 24 |
/// Returns a string that is suitable to assist humans in debugging |
| 25 |
/// this error. |
| 26 |
/// |
| 27 |
/// WARNING: The returned string should not be consumed mechanically! |
| 28 |
/// It may change across platforms, hosts, or other implementation |
| 29 |
/// details. Parsing this string is a major platform-compatibility |
| 30 |
/// hazard. |
| 31 |
@since(version = 0.2.0) |
| 32 |
to-debug-string: func() -> string; |
| 33 |
} |
| 34 |
} |