mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
refactor(plugin): add SetupPlugin and StartPlugin error (#4554)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user