mirror of
https://github.com/katanemo/plano.git
synced 2026-05-04 21:32:43 +02:00
40 lines
1 KiB
Rust
40 lines
1 KiB
Rust
|
|
use proxy_wasm::types::Status;
|
||
|
|
|
||
|
|
use crate::ratelimit;
|
||
|
|
|
||
|
|
#[derive(thiserror::Error, Debug)]
|
||
|
|
pub enum ClientError {
|
||
|
|
#[error("Error dispatching HTTP call to `{upstream_name}/{path}`, error: {internal_status:?}")]
|
||
|
|
DispatchError {
|
||
|
|
upstream_name: String,
|
||
|
|
path: String,
|
||
|
|
internal_status: Status,
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(thiserror::Error, Debug)]
|
||
|
|
pub enum ServerError {
|
||
|
|
#[error(transparent)]
|
||
|
|
HttpDispatch(ClientError),
|
||
|
|
#[error(transparent)]
|
||
|
|
Deserialization(serde_json::Error),
|
||
|
|
#[error(transparent)]
|
||
|
|
Serialization(serde_json::Error),
|
||
|
|
#[error("{0}")]
|
||
|
|
LogicError(String),
|
||
|
|
#[error("upstream error response authority={authority}, path={path}, status={status}")]
|
||
|
|
Upstream {
|
||
|
|
authority: String,
|
||
|
|
path: String,
|
||
|
|
status: String,
|
||
|
|
},
|
||
|
|
#[error("jailbreak detected: {0}")]
|
||
|
|
Jailbreak(String),
|
||
|
|
#[error("{why}")]
|
||
|
|
NoMessagesFound { why: String },
|
||
|
|
#[error(transparent)]
|
||
|
|
ExceededRatelimit(ratelimit::Error),
|
||
|
|
#[error("{why}")]
|
||
|
|
BadRequest { why: String },
|
||
|
|
}
|