1 Star 0 Fork 0

auto-stack/auto-coder

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
errors.rs 1.90 KB
Copy Edit Raw Blame History
// API, tool, and runtime error types
/// Errors from the API layer (HTTP, JSON, SSE, auth).
#[derive(Clone, Debug, PartialEq)]
pub enum ApiError {
Http(String),
Json(String),
Api(u32, String, bool),
Sse(String),
Auth(String),
RetriesExhausted(u32),
}
impl std::fmt::Display for ApiError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
ApiError::Http(msg) => write!(f, "Http: {}", msg),
ApiError::Json(msg) => write!(f, "Json: {}", msg),
ApiError::Api(status, msg, _retry) => write!(f, "Api({}): {}", status, msg),
ApiError::Sse(msg) => write!(f, "Sse: {}", msg),
ApiError::Auth(msg) => write!(f, "Auth: {}", msg),
ApiError::RetriesExhausted(n) => write!(f, "RetriesExhausted({})", n),
}
}
}
/// Errors from tool execution.
#[derive(Clone, Debug, PartialEq)]
pub enum ToolError {
ExecutionFailed(String),
InvalidInput(String),
PermissionDenied(String),
}
impl std::fmt::Display for ToolError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
ToolError::ExecutionFailed(msg) => write!(f, "ExecutionFailed: {}", msg),
ToolError::InvalidInput(msg) => write!(f, "InvalidInput: {}", msg),
ToolError::PermissionDenied(msg) => write!(f, "PermissionDenied: {}", msg),
}
}
}
/// Errors from the agent runtime.
#[derive(Clone, Debug, PartialEq)]
pub enum RuntimeError {
Api(String),
MaxIterations(u32),
EmptyResponse,
}
impl std::fmt::Display for RuntimeError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
RuntimeError::Api(msg) => write!(f, "Api: {}", msg),
RuntimeError::MaxIterations(n) => write!(f, "MaxIterations({})", n),
RuntimeError::EmptyResponse => write!(f, "EmptyResponse"),
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/auto-stack/auto-coder.git
git@gitee.com:auto-stack/auto-coder.git
auto-stack
auto-coder
auto-coder
master

Search