Skip to content

Commit 1b3e72d

Browse files
committed
Improve error messages for decay midpoint and scale validation
1 parent 7740be5 commit 1b3e72d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/segment/src/index/query_optimization/rescore_formula/parsed_formula.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ impl ParsedExpression {
164164
let scale = scale.unwrap_or(DEFAULT_DECAY_SCALE);
165165

166166
if midpoint <= 0.0 || midpoint >= 1.0 {
167-
return Err(OperationError::validation_error(
168-
"Decay midpoint should be between 0.0 and 1.0, not inclusive.",
169-
));
167+
return Err(OperationError::validation_error(format!(
168+
"Decay midpoint should be between 0.0 and 1.0 (exclusive), got {midpoint}."
169+
)));
170170
}
171171

172172
if scale <= 0.0 {
173-
return Err(OperationError::validation_error(
174-
"Decay scale should be non-zero positive.",
175-
));
173+
return Err(OperationError::validation_error(format!(
174+
"Decay scale should be non-zero positive, got {scale}."
175+
)));
176176
}
177177

178178
let lambda = match kind {

0 commit comments

Comments
 (0)