Skip to content

Commit 355cb5a

Browse files
committed
Changed: use tool_names::EDIT constant in edit_error_to_serdes
Replace hardcoded 'edit' strings with tool_names::EDIT constant for consistency. This centralizes tool naming and ensures all tool names are defined in a single location.
1 parent 599357a commit 355cb5a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/llm-coding-tools-serdesai/src/convert.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! [`llm_coding_tools_core`]: llm_coding_tools_core
77
88
use llm_coding_tools_core::operations::EditError;
9+
use llm_coding_tools_core::tool_names;
910
use llm_coding_tools_core::{ToolError as CoreError, ToolOutput, ToolResult as CoreResult};
1011
use serde_json::json;
1112
use serdes_ai::tools::{ToolError as SerdesError, ToolReturn};
@@ -68,28 +69,28 @@ pub fn to_serdes_result(
6869
pub fn edit_error_to_serdes(err: EditError) -> SerdesError {
6970
match err {
7071
EditError::NotFound => SerdesError::validation_error(
71-
"edit",
72+
tool_names::EDIT,
7273
Some("old_string".to_string()),
7374
"old_string not found in file content".to_string(),
7475
),
7576
EditError::AmbiguousMatch(count) => SerdesError::validation_error(
76-
"edit",
77+
tool_names::EDIT,
7778
Some("old_string".to_string()),
7879
format!(
7980
"old_string found {count} times and requires more code context to uniquely identify the intended match"
8081
),
8182
),
8283
EditError::EmptyOldString => SerdesError::validation_error(
83-
"edit",
84+
tool_names::EDIT,
8485
Some("old_string".to_string()),
8586
"old_string must not be empty".to_string(),
8687
),
8788
EditError::IdenticalStrings => SerdesError::validation_error(
88-
"edit",
89+
tool_names::EDIT,
8990
None,
9091
"old_string and new_string must be different".to_string(),
9192
),
92-
EditError::Tool(tool_err) => core_error_to_serdes("edit", tool_err),
93+
EditError::Tool(tool_err) => core_error_to_serdes(tool_names::EDIT, tool_err),
9394
}
9495
}
9596

0 commit comments

Comments
 (0)