refactor(plugin): add SetupPlugin and StartPlugin error (#4554)

This commit is contained in:
zyy17
2024-08-13 19:22:48 +08:00
committed by GitHub
parent 216bce6973
commit 63e1892dc1
3 changed files with 55 additions and 5 deletions

View File

@@ -395,6 +395,20 @@ pub enum Error {
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to setup plugin"))]
SetupPlugin {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
#[snafu(display("Failed to start plugin"))]
StartPlugin {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
}
pub type Result<T> = std::result::Result<T, Error>;
@@ -442,9 +456,12 @@ impl ErrorExt for Error {
AsyncTaskExecute { source, .. } => source.status_code(),
CreateDir { .. } | RemoveDir { .. } | ShutdownInstance { .. } | DataFusion { .. } => {
StatusCode::Internal
}
CreateDir { .. }
| RemoveDir { .. }
| ShutdownInstance { .. }
| DataFusion { .. }
| SetupPlugin { .. }
| StartPlugin { .. } => StatusCode::Internal,
RegionNotFound { .. } => StatusCode::RegionNotFound,
RegionNotReady { .. } => StatusCode::RegionNotReady,

View File

@@ -364,6 +364,20 @@ pub enum Error {
#[snafu(implicit)]
location: Location,
},
#[snafu(display("Failed to setup plugin"))]
SetupPlugin {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
#[snafu(display("Failed to start plugin"))]
StartPlugin {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
}
pub type Result<T> = std::result::Result<T, Error>;
@@ -416,7 +430,10 @@ impl ErrorExt for Error {
Error::FindDatanode { .. } => StatusCode::RegionNotReady,
Error::VectorToGrpcColumn { .. } | Error::CacheRequired { .. } => StatusCode::Internal,
Error::VectorToGrpcColumn { .. }
| Error::CacheRequired { .. }
| Error::SetupPlugin { .. }
| Error::StartPlugin { .. } => StatusCode::Internal,
Error::InvalidRegionRequest { .. } => StatusCode::IllegalState,

View File

@@ -851,6 +851,20 @@ pub enum Error {
#[snafu(source(from(common_config::error::Error, Box::new)))]
source: Box<common_config::error::Error>,
},
#[snafu(display("Failed to setup plugin"))]
SetupPlugin {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
#[snafu(display("Failed to start plugin"))]
StartPlugin {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
}
impl Error {
@@ -902,7 +916,9 @@ impl ErrorExt for Error {
| Error::Join { .. }
| Error::WeightArray { .. }
| Error::NotSetWeightArray { .. }
| Error::PeerUnavailable { .. } => StatusCode::Internal,
| Error::PeerUnavailable { .. }
| Error::SetupPlugin { .. }
| Error::StartPlugin { .. } => StatusCode::Internal,
Error::Unsupported { .. } => StatusCode::Unsupported,