diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -37,6 +37,7 @@ impl ProxyConfig { #[derive(Debug)] pub enum ProxyError { HttpError(String), + UpstreamError(String), ParseError(String), UnknownIndex(String), NotSupported(String), @@ -46,6 +47,7 @@ impl ProxyError { pub fn http_status_code(&self) -> StatusCode { match self { ProxyError::HttpError(_) => StatusCode::BAD_REQUEST, + ProxyError::UpstreamError(_) => StatusCode::BAD_GATEWAY, ProxyError::ParseError(_) => StatusCode::BAD_REQUEST, ProxyError::UnknownIndex(_) => StatusCode::NOT_FOUND, ProxyError::NotSupported(_) => StatusCode::FORBIDDEN, @@ -55,6 +57,7 @@ impl ProxyError { pub fn to_json_value(&self) -> serde_json::Value { let (type_slug, reason) = match self { ProxyError::HttpError(s) => ("http-error", s.clone()), + ProxyError::UpstreamError(s) => ("upstream-error", s.clone()), ProxyError::ParseError(s) => ("parse-error", s.clone()), ProxyError::UnknownIndex(index) => ( "unknown-index", |