分页 limit 的诊断改成「非负整数」,与 offset 保持一致
- ToolPageRejection::LimitNotInteger 原文案说 limit「必须是整数」,但负数(如 -1)走到这个分支时本身就是整数,读起来自相矛盾 - 解析用的是 as_u64,真实约束是非负;文案改成与 OffsetNotInteger 相同的「非负整数」,只改措辞,判定与变体结构不变 验证:cargo check --bin genarrative-ai-game-creator-shell --tests 通过
This commit is contained in:
@@ -111,7 +111,7 @@ impl ToolFailure for ToolPageRejection {
|
||||
format!("工具参数 offset={got} 超出上限 {max},请从更小的偏移重新分页。")
|
||||
}
|
||||
Self::LimitNotInteger { got } => {
|
||||
format!("工具参数 limit 必须是整数,当前是「{got}」。")
|
||||
format!("工具参数 limit 必须是非负整数,当前是「{got}」。")
|
||||
}
|
||||
Self::LimitOutOfRange { got, max } => {
|
||||
format!("工具参数 limit={got} 超出范围,必须在 1 到 {max} 之间。")
|
||||
|
||||
Reference in New Issue
Block a user