Generate strerror from witx; tweak Display for WasiError (#832)
This commit introduces two small changes: * it adds `gen_errno_strerror` to `wig` crate which generates a `strerror` function for `__wasi_errno_t` directly from `*.witx`, similarly to how it's done in the `wasi` crate * it tweaks `WasiError` type to include the error message generated with `strerror` when displaying the error
This commit is contained in:
committed by
Alex Crichton
parent
5b8be5f262
commit
5f1c0eb86b
@@ -8,7 +8,7 @@ use thiserror::Error;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Error, Eq, PartialEq)]
|
||||
#[repr(u16)]
|
||||
#[error("{:?}", self)]
|
||||
#[error("{:?} ({})", self, wasi::strerror(*self as wasi::__wasi_errno_t))]
|
||||
pub enum WasiError {
|
||||
ESUCCESS = wasi::__WASI_ERRNO_SUCCESS,
|
||||
E2BIG = wasi::__WASI_ERRNO_2BIG,
|
||||
|
||||
Reference in New Issue
Block a user