summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9093b24..9145fb1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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",