slight improvements to error messaging
This commit is contained in:
@ -146,7 +146,7 @@ fn format_drop_errors(raw_errors: Vec<(String, String, String)>, instance: &Valu
|
||||
|
||||
// 2. Deduplicate by instance_path and format as DropError
|
||||
let mut unique_errors: HashMap<String, Value> = HashMap::new();
|
||||
for (instance_path, schema_path, message) in plausible_errors {
|
||||
for (instance_path, _schema_path, message) in plausible_errors {
|
||||
if let Entry::Vacant(entry) = unique_errors.entry(instance_path.clone()) {
|
||||
// Convert message to error code and make it human readable
|
||||
let (code, human_message) = enhance_error_message(&message);
|
||||
@ -158,11 +158,8 @@ fn format_drop_errors(raw_errors: Vec<(String, String, String)>, instance: &Valu
|
||||
"code": code,
|
||||
"message": human_message,
|
||||
"details": {
|
||||
"path": schema_path,
|
||||
"context": json!({
|
||||
"instance_path": instance_path,
|
||||
"failing_value": failing_value
|
||||
}),
|
||||
"path": instance_path,
|
||||
"context": failing_value,
|
||||
"cause": message // Original error message
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user