Trait wasmcloud_runtime::capability::http::types::Host

source ·
pub trait Host:
    Send
    + HostFields
    + HostIncomingRequest
    + HostOutgoingRequest
    + HostRequestOptions
    + HostResponseOutparam
    + HostIncomingResponse
    + HostIncomingBody
    + HostFutureTrailers
    + HostOutgoingResponse
    + HostOutgoingBody
    + HostFutureIncomingResponse {
    // Required methods
    fn http_error_code(
        &mut self,
        err: Resource<Error>,
    ) -> Result<Option<ErrorCode>, Error>;
    fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode, Error>;
}

Required Methods§

source

fn http_error_code( &mut self, err: Resource<Error>, ) -> Result<Option<ErrorCode>, Error>

Attempts to extract a http-related error from the wasi:io error provided.

Stream operations which return wasi:io/stream/stream-error::last-operation-failed have a payload of type wasi:io/error/error with more information about the operation that failed. This payload can be passed through to this function to see if there’s http-related information about the error to return.

Note that this function is fallible because not all io-errors are http-related errors.

source

fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode, Error>

Implementations on Foreign Types§

source§

impl<_T> Host for &mut _T
where _T: Host + Send + ?Sized,

source§

fn http_error_code( &mut self, err: Resource<Error>, ) -> Result<Option<ErrorCode>, Error>

Attempts to extract a http-related error from the wasi:io error provided.

Stream operations which return wasi:io/stream/stream-error::last-operation-failed have a payload of type wasi:io/error/error with more information about the operation that failed. This payload can be passed through to this function to see if there’s http-related information about the error to return.

Note that this function is fallible because not all io-errors are http-related errors.

source§

fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode, Error>

Implementors§

source§

impl<T> Host for WasiHttpImpl<T>
where T: WasiHttpView,