分页 offset/limit 的类型错回显改用 not_text_repr,与其它字段同一限长口径
- arguments::page 的 OffsetNotInteger / LimitNotInteger 原来用 value.to_string() 无界回显,超大对象/字符串会整份进错误消息与诊断 - 改用共享的 not_text_repr(120 字符截断),与 optional_text 及内联判类型的字段一致 验证:cargo fmt --check 通过
This commit is contained in:
@@ -91,7 +91,7 @@ pub(crate) fn page(
|
||||
.as_u64()
|
||||
.and_then(|value| usize::try_from(value).ok())
|
||||
.ok_or_else(|| ToolPageRejection::OffsetNotInteger {
|
||||
got: value.to_string(),
|
||||
got: not_text_repr(value),
|
||||
})
|
||||
})
|
||||
.transpose()?
|
||||
@@ -107,7 +107,7 @@ pub(crate) fn page(
|
||||
.as_u64()
|
||||
.and_then(|value| usize::try_from(value).ok())
|
||||
.ok_or_else(|| ToolPageRejection::LimitNotInteger {
|
||||
got: value.to_string(),
|
||||
got: not_text_repr(value),
|
||||
})
|
||||
})
|
||||
.transpose()?
|
||||
|
||||
Reference in New Issue
Block a user