feat: complete tree shell cutover and regression coverage
This commit is contained in:
@@ -78,7 +78,11 @@ pub fn build_tree_target(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ensure_non_empty(value: &str, field: &'static str, context: &RequestContext) -> Result<String, WebError> {
|
||||
pub fn ensure_non_empty(
|
||||
value: &str,
|
||||
field: &'static str,
|
||||
context: &RequestContext,
|
||||
) -> Result<String, WebError> {
|
||||
let trimmed = value.trim();
|
||||
if trimmed.is_empty() {
|
||||
return Err(WebError::bad_request_code(
|
||||
@@ -99,12 +103,11 @@ pub fn read_optional_non_empty(value: Option<String>) -> Option<String> {
|
||||
|
||||
pub fn ensure_sort_order(sort_order: i64, context: &RequestContext) -> Result<i64, WebError> {
|
||||
if sort_order < 0 {
|
||||
return Err(WebError::bad_request_code(
|
||||
"tree_command_validation",
|
||||
"sortOrder 不能小于 0",
|
||||
)
|
||||
.with_context(context)
|
||||
.with_header("x-error-phase", "tree_command_validate"));
|
||||
return Err(
|
||||
WebError::bad_request_code("tree_command_validation", "sortOrder 不能小于 0")
|
||||
.with_context(context)
|
||||
.with_header("x-error-phase", "tree_command_validate"),
|
||||
);
|
||||
}
|
||||
Ok(sort_order)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user