Fetch the repository succeeded.
// 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"),
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。