mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-29 16:45:30 +08:00
Introduce a new internal error type to categorize panics
This commit is contained in:
parent
0c7003c5df
commit
96cc5319c8
@ -49,6 +49,8 @@ pub enum InternalError {
|
|||||||
InvalidDatabaseTyping,
|
InvalidDatabaseTyping,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
RayonThreadPool(#[from] ThreadPoolBuildError),
|
RayonThreadPool(#[from] ThreadPoolBuildError),
|
||||||
|
#[error("A panic occured. Read the logs to find more information about it.")]
|
||||||
|
PanicInThreadPool,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
SerdeJson(#[from] serde_json::Error),
|
SerdeJson(#[from] serde_json::Error),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
@ -540,6 +540,11 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
// While reseting the pool panic catcher we return an error if we catched one.
|
||||||
|
if pool_catched_panic.swap(false, Ordering::SeqCst) {
|
||||||
|
return Err(InternalError::PanicInThreadPool.into());
|
||||||
|
}
|
||||||
|
|
||||||
// We write the field distribution into the main database
|
// We write the field distribution into the main database
|
||||||
self.index.put_field_distribution(self.wtxn, &field_distribution)?;
|
self.index.put_field_distribution(self.wtxn, &field_distribution)?;
|
||||||
|
|
||||||
@ -568,6 +573,11 @@ where
|
|||||||
}
|
}
|
||||||
Result::Ok(())
|
Result::Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
// While reseting the pool panic catcher we return an error if we catched one.
|
||||||
|
if pool_catched_panic.swap(false, Ordering::SeqCst) {
|
||||||
|
return Err(InternalError::PanicInThreadPool.into());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.execute_prefix_databases(
|
self.execute_prefix_databases(
|
||||||
|
Loading…
Reference in New Issue
Block a user