From 917ea9abf81c851abc841136055d4b96b56d1599 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 15 Nov 2022 16:59:50 -0800 Subject: [PATCH] docs --- crates/wasi-common/src/error.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/wasi-common/src/error.rs b/crates/wasi-common/src/error.rs index 3b4311b4d339..b1a5135bb2b0 100644 --- a/crates/wasi-common/src/error.rs +++ b/crates/wasi-common/src/error.rs @@ -1,6 +1,13 @@ -//! TK rewrite the documentation +//! wasi-common uses an [`Error`] type which represents either a preview 1 [`Errno`] enum, on +//! [`anyhow::Error`] for trapping execution. +//! +//! The user can construct an [`Error`] out of an [`Errno`] using the `From`/`Into` traits. +//! They may also use [`Error::trap`] to construct an error that traps execution. The contents +//! can be inspected with [`Error::downcast`] and [`Error::downcast_ref`]. Additional context +//! can be provided with the [`Error::context`] method. This context is only observable with the +//! `Display` and `Debug` impls of the error. -pub use crate::snapshots::preview_1::error::{Error, ErrorExt}; +pub use crate::snapshots::preview_1::error::{Errno, Error, ErrorExt}; use std::fmt; /// An error returned from the `proc_exit` host syscall.