MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / classify_tool_error

Function classify_tool_error

crates/opencode-session/src/llm.rs:1294–1311  ·  view source on GitHub ↗
(kind: Option<StreamToolErrorKind>, error: &str)

Source from the content-addressed store, hash-verified

1292}
1293
1294fn classify_tool_error(kind: Option<StreamToolErrorKind>, error: &str) -> ToolExecutionErrorKind {
1295 if let Some(kind) = kind {
1296 return match kind {
1297 StreamToolErrorKind::PermissionDenied => ToolExecutionErrorKind::PermissionDenied,
1298 StreamToolErrorKind::QuestionRejected => ToolExecutionErrorKind::QuestionRejected,
1299 StreamToolErrorKind::ExecutionError => ToolExecutionErrorKind::Other,
1300 };
1301 }
1302
1303 let lower = error.to_ascii_lowercase();
1304 if lower.starts_with("permission denied:") || lower.contains("permission denied") {
1305 return ToolExecutionErrorKind::PermissionDenied;
1306 }
1307 if lower.starts_with("question rejected:") || lower.contains("question rejected") {
1308 return ToolExecutionErrorKind::QuestionRejected;
1309 }
1310 ToolExecutionErrorKind::Other
1311}
1312
1313fn build_messages(system: &[String], user_messages: &[Message]) -> Vec<Message> {
1314 let mut messages: Vec<Message> = system.iter().map(|s| Message::system(s)).collect();

Callers

nothing calls this directly

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected