From 51a57bab4dd5f8159232305dcf660c450466f60f Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 12 Sep 2023 17:30:41 -0500 Subject: [PATCH] Fill in the 'error' variant --- wit/types.wit | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/wit/types.wit b/wit/types.wit index 6d92a88..4490c81 100644 --- a/wit/types.wit +++ b/wit/types.wit @@ -26,14 +26,42 @@ interface types { other(string) } - // TODO: perhaps better align with HTTP semantics? - // This type enumerates the different kinds of errors that may occur when - // initially returning a response. + // The cases of this variant correspond to the IANA HTTP Proxy Error Types: + // https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types + // Note: the `http_request_error` case maps to an `ok` response with a 4xx + // `status-code`. variant error { - invalid-url(string), - timeout-error(string), - protocol-error(string), - unexpected-error(string) + DNS-timeout, + DNS-error(string, u16), + destination-not-found, + destination-unavailable, + destination-IP-prohibited, + destination-IP-unroutable, + connection-refused, + connection-terminated, + connection-timeout, + connection-read-timeout, + connection-write-timeout, + connection-limit-reached, + TLS-protocol-error, + TLS-certificate-error, + TLS-alert-received(u8, string), + HTTP-request-denied, + HTTP-response-incomplete, + HTTP-response-header-section-size(u32), + HTTP-response-header-size(string, u32), + HTTP-response-body-size(u32), + HTTP-response-trailer-section-size(u32), + HTTP-response-trailer-size(string, u32), + HTTP-response-transfer-coding(string), + HTTP-response-content-coding(string), + HTTP-response-timeout, + HTTP-upgrade-failed, + HTTP-protocol-error, + proxy-internal-response, + proxy-internal-error, + proxy-configuration-error, + proxy-loop-detected } // This following block defines the `fields` resource which corresponds to