mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-22 16:44:21 +01:00
fix: return tool error for invalid param in computer controller (#1430)
This commit is contained in:
@@ -501,7 +501,12 @@ impl ComputerControllerRouter {
|
|||||||
})?;
|
})?;
|
||||||
(bytes.to_vec(), "bin")
|
(bytes.to_vec(), "bin")
|
||||||
}
|
}
|
||||||
_ => unreachable!(), // Prevented by enum in tool definition
|
_ => {
|
||||||
|
return Err(ToolError::InvalidParameters(format!(
|
||||||
|
"Invalid 'save_as' parameter: {}. Valid options are: 'text', 'json', 'binary'",
|
||||||
|
save_as
|
||||||
|
)));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save to cache
|
// Save to cache
|
||||||
@@ -571,7 +576,11 @@ impl ComputerControllerRouter {
|
|||||||
script_path.display()
|
script_path.display()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
_ => unreachable!(), // Prevented by enum in tool definition
|
_ => {
|
||||||
|
return Err( ToolError::InvalidParameters(
|
||||||
|
format!("Invalid 'language' parameter: {}. Valid options are: 'shell', 'batch', 'ruby', 'powershell", language)
|
||||||
|
));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run the script
|
// Run the script
|
||||||
@@ -712,7 +721,10 @@ impl ComputerControllerRouter {
|
|||||||
|
|
||||||
Ok(vec![Content::text("Cache cleared successfully.")])
|
Ok(vec![Content::text("Cache cleared successfully.")])
|
||||||
}
|
}
|
||||||
_ => unreachable!(), // Prevented by enum in tool definition
|
_ => Err(ToolError::InvalidParameters(format!(
|
||||||
|
"Invalid 'command' parameter: {}. Valid options are: 'list', 'view', 'delete', 'clear'",
|
||||||
|
command
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user