pub enum Error {
ErrorCode(ErrorCode),
HttpError(Error),
Other(Box<dyn Error + Send + Sync>),
Response(Response),
}wasip3-unstable 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.