mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
tidy
This commit is contained in:
parent
ce12000af3
commit
c7b489f8cb
@ -35,13 +35,10 @@ impl Display for DocumentFormatError {
|
|||||||
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) => {
|
milli::documents::Error::JsonError(se) => {
|
||||||
// "invalid type: {}, expected {}"
|
|
||||||
let mut serde_msg = se.to_string();
|
|
||||||
|
|
||||||
// https://github.com/meilisearch/meilisearch/issues/2107
|
// https://github.com/meilisearch/meilisearch/issues/2107
|
||||||
// The user input maybe insanely long. We need to truncate it.
|
// The user input maybe insanely long. We need to truncate it.
|
||||||
|
let mut serde_msg = se.to_string();
|
||||||
let prefix = r#"invalid type: string ""#;
|
let prefix = r#"invalid type: string ""#;
|
||||||
|
|
||||||
if serde_msg.starts_with(prefix) {
|
if serde_msg.starts_with(prefix) {
|
||||||
let start_idx = prefix.len();
|
let start_idx = prefix.len();
|
||||||
if let Some(end_idx) = serde_msg.rfind("\"") {
|
if let Some(end_idx) = serde_msg.rfind("\"") {
|
||||||
|
Loading…
Reference in New Issue
Block a user