pub enum Error {
ErrorCode(ErrorCode),
HttpError(Error),
Other(Box<dyn Error + Send + Sync>),
Response(Response),
}http only.Expand description
The error type used for HTTP operations within the WASI environment.
This enum provides a unified representation of all errors that can occur during HTTP request or response handling, whether they originate from WASI-level error codes, dynamic runtime failures, or full HTTP responses returned as error results.
§See also
http::Error: Error type originating from thehttpcrate.wasip3::http::types::ErrorCode: Standard WASI HTTP error codes.wasip3::http::types::Response: Used when an error represents an HTTP response body.
Variants§
ErrorCode(ErrorCode)
A low-level WASI HTTP error code.
Wraps wasip3::http::types::ErrorCode to represent
transport-level or protocol-level failures.
HttpError(Error)
An error originating from the http crate.
Covers errors encountered during the construction,
parsing, or validation of http types (e.g. invalid headers,
malformed URIs, or protocol violations).
Other(Box<dyn Error + Send + Sync>)
A dynamic application or library error.
Used for any runtime error that implements std::error::Error,
allowing flexibility for different error sources.
Response(Response)
An HTTP response treated as an error.
Contains a full wasip3::http::types::Response, such as
a 404 Not Found or 500 Internal Server Error, when
the response itself represents an application-level failure.
Implementations§
Source§impl Error
impl Error
Sourcepub fn other(msg: impl Into<String>) -> Self
pub fn other(msg: impl Into<String>) -> Self
Creates an Error::Other from a displayable message.
This is a convenience constructor for producing errors
without manually wrapping in Error::Other.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()