mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-06-05 01:50:42 +00:00
@@ -422,12 +422,8 @@ pub enum DocParsingError {
|
||||
impl DocParsingError {
|
||||
/// Builds a NotJson DocParsingError
|
||||
fn invalid_json(invalid_json: &str) -> Self {
|
||||
let sample_json: String = if invalid_json.len() < 20 {
|
||||
invalid_json.to_string()
|
||||
} else {
|
||||
format!("{:?}...", &invalid_json[0..20])
|
||||
};
|
||||
DocParsingError::InvalidJson(sample_json)
|
||||
let sample = invalid_json.chars().take(20).collect();
|
||||
DocParsingError::InvalidJson(sample)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,6 +789,11 @@ mod tests {
|
||||
))
|
||||
);
|
||||
}
|
||||
{
|
||||
// Short JSON, under the 20 char take.
|
||||
let json_err = schema.parse_document(r#"{"count": 50,}"#);
|
||||
assert_matches!(json_err, Err(InvalidJson(_)));
|
||||
}
|
||||
{
|
||||
let json_err = schema.parse_document(
|
||||
r#"{
|
||||
|
||||
Reference in New Issue
Block a user