mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-11-22 04:36:32 +00:00
Improve error message extraction
Co-authored-by: Many the fish <many@meilisearch.com>
This commit is contained in:
@@ -438,12 +438,15 @@ async fn multipart_stream_to_s3(
|
|||||||
db_name: String,
|
db_name: String,
|
||||||
reader: std::io::PipeReader,
|
reader: std::io::PipeReader,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
use std::{collections::VecDeque, io, os::fd::OwnedFd, path::PathBuf};
|
use std::collections::VecDeque;
|
||||||
|
use std::io;
|
||||||
|
use std::os::fd::OwnedFd;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use reqwest::{Client, Response};
|
use reqwest::{Client, Response};
|
||||||
use rusty_s3::S3Action as _;
|
use rusty_s3::actions::CreateMultipartUpload;
|
||||||
use rusty_s3::{actions::CreateMultipartUpload, Bucket, BucketError, Credentials, UrlStyle};
|
use rusty_s3::{Bucket, BucketError, Credentials, S3Action as _, UrlStyle};
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
let reader = OwnedFd::from(reader);
|
let reader = OwnedFd::from(reader);
|
||||||
@@ -579,13 +582,12 @@ async fn multipart_stream_to_s3(
|
|||||||
let body = body.clone();
|
let body = body.clone();
|
||||||
async move {
|
async move {
|
||||||
match client.post(url).body(body).send().await {
|
match client.post(url).body(body).send().await {
|
||||||
Ok(resp) if resp.status().is_client_error() => match resp.error_for_status_ref() {
|
Ok(resp) if resp.status().is_client_error() => {
|
||||||
Ok(_) => Ok(resp),
|
Err(backoff::Error::Permanent(Error::S3Error {
|
||||||
Err(_) => Err(backoff::Error::Permanent(Error::S3Error {
|
|
||||||
status: resp.status(),
|
status: resp.status(),
|
||||||
body: resp.text().await.unwrap_or_default(),
|
body: resp.text().await.unwrap_or_default(),
|
||||||
})),
|
}))
|
||||||
},
|
}
|
||||||
Ok(resp) => Ok(resp),
|
Ok(resp) => Ok(resp),
|
||||||
Err(e) => Err(backoff::Error::transient(Error::S3HttpError(e))),
|
Err(e) => Err(backoff::Error::transient(Error::S3HttpError(e))),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
use crate::search::{Personalize, SearchResult};
|
use std::time::Duration;
|
||||||
use meilisearch_types::{
|
|
||||||
error::{Code, ErrorCode, ResponseError},
|
use meilisearch_types::error::{Code, ErrorCode, ResponseError};
|
||||||
milli::TimeBudget,
|
use meilisearch_types::milli::TimeBudget;
|
||||||
};
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
|
||||||
use tracing::{debug, info, warn};
|
use tracing::{debug, info, warn};
|
||||||
|
|
||||||
|
use crate::search::{Personalize, SearchResult};
|
||||||
|
|
||||||
const COHERE_API_URL: &str = "https://api.cohere.ai/v1/rerank";
|
const COHERE_API_URL: &str = "https://api.cohere.ai/v1/rerank";
|
||||||
const MAX_RETRIES: u32 = 10;
|
const MAX_RETRIES: u32 = 10;
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,9 @@ use serde::{Deserialize, Serialize};
|
|||||||
use utoipa::ToSchema;
|
use utoipa::ToSchema;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::search::SearchMetadata;
|
|
||||||
|
|
||||||
use super::super::{ComputedFacets, FacetStats, HitsInfo, SearchHit, SearchQueryWithIndex};
|
use super::super::{ComputedFacets, FacetStats, HitsInfo, SearchHit, SearchQueryWithIndex};
|
||||||
use crate::milli::vector::Embedding;
|
use crate::milli::vector::Embedding;
|
||||||
|
use crate::search::SearchMetadata;
|
||||||
|
|
||||||
pub const DEFAULT_FEDERATED_WEIGHT: f64 = 1.0;
|
pub const DEFAULT_FEDERATED_WEIGHT: f64 = 1.0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user