mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-04 08:12:54 +00:00
allow LenientError to be serializable too
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! nom combinators for infallible operations
|
||||
|
||||
use std::convert::Infallible;
|
||||
|
||||
use serde::Serialize;
|
||||
use nom::{AsChar, IResult, InputLength, InputTakeAtPosition};
|
||||
|
||||
pub(crate) type ErrorList = Vec<LenientErrorInternal>;
|
||||
@@ -15,7 +15,7 @@ pub(crate) struct LenientErrorInternal {
|
||||
}
|
||||
|
||||
/// A recoverable error and the position it happened at
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Serialize)]
|
||||
pub struct LenientError {
|
||||
pub pos: usize,
|
||||
pub message: String,
|
||||
|
||||
@@ -47,5 +47,7 @@ mod tests {
|
||||
fn test_parse_query_lenient_wrong_query() {
|
||||
let (_, errors) = parse_query_lenient("title:");
|
||||
assert!(errors.len() == 1);
|
||||
let json = serde_json::to_string(&errors).unwrap();
|
||||
assert_eq!(json, r#"[{"pos":6,"message":"expected word"}]"#);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user