Update meilisearch-lib/src/document_formats.rs

Co-authored-by: Clément Renault <renault.cle@gmail.com>
This commit is contained in:
LiuHanCheng 2022-03-08 12:03:59 +08:00 committed by GitHub
parent a356c8359c
commit c8895cab77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,14 +32,14 @@ pub enum DocumentFormatError {
impl Display for DocumentFormatError { impl Display for DocumentFormatError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
Self::Internal(e) => write!(f, "An internal error has occurred. `{}`.", e), Self::Internal(e) => write!(f, "An internal error has occurred: `{}`.", e),
Self::MalformedPayload(me, b) => match me.borrow() { Self::MalformedPayload(me, b) => match me.borrow() {
milli::documents::Error::JsonError(se) => write!( milli::documents::Error::JsonError(se) => write!(
f, f,
"The `{}` payload provided is malformed. `Couldn't serialize document value. at line {} column {}`", "The `{}` payload provided is malformed. `Couldn't serialize document value at line {} column {}`",
b, se.line(), se.column() b, se.line(), se.column()
), ),
_ => write!(f, "The `{}` payload provided is malformed. `{}`.", b, me), _ => write!(f, "The `{}` payload provided is malformed: `{}`.", b, me),
}, },
} }
} }