malformed payload error

This commit is contained in:
mpostma 2021-09-30 10:35:24 +02:00 committed by Tamo
parent 137272b8de
commit ddd40d87a7
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
3 changed files with 14 additions and 5 deletions

View file

@ -2,6 +2,7 @@ use std::fmt;
use std::io::{self, Read, Result as IoResult, Seek, Write};
use csv::{Reader as CsvReader, StringRecordsIntoIter};
use meilisearch_error::{Code, ErrorCode};
use milli::documents::DocumentBatchBuilder;
use serde_json::{Deserializer, Map, Value};
@ -35,6 +36,15 @@ pub enum DocumentFormatError {
),
}
impl ErrorCode for DocumentFormatError {
fn error_code(&self) -> Code {
match self {
DocumentFormatError::Internal(_) => Code::Internal,
DocumentFormatError::MalformedPayload(_, _) => Code::MalformedPayload,
}
}
}
internal_error!(DocumentFormatError: milli::documents::Error, io::Error);
macro_rules! malformed {