walrus/
error.rs

1//! Error types and utilities.
2
3use std::fmt;
4
5/// Either `Ok(T)` or `Err(failure::Error)`.
6pub use anyhow::Result;
7
8/// A leaf wasm error type.
9///
10/// Just an enum with no further information. Extra diagnostics are attached via
11/// failure's `context` method.
12#[derive(Copy, Clone, Eq, PartialEq, Debug)]
13pub enum ErrorKind {
14    /// Given invalid input wasm.
15    InvalidWasm,
16}
17
18impl fmt::Display for ErrorKind {
19    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20        match self {
21            ErrorKind::InvalidWasm => "The input WebAssembly is invalid".fmt(f),
22        }
23    }
24}
25
26impl std::error::Error for ErrorKind {}