refactor: remove useless error (#1624)

* refactor: remove useless

* fix: remove useless error variant
This commit is contained in:
Lei, HUANG
2023-05-22 22:55:27 +08:00
committed by GitHub
parent f64527da22
commit 8e7ec4626b
23 changed files with 24 additions and 395 deletions

View File

@@ -186,12 +186,6 @@ pub enum Error {
source: table::error::Error,
},
#[snafu(display("Failure during SchemaProvider operation, source: {}", source))]
SchemaProviderOperation {
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display("{source}"))]
Internal {
#[snafu(backtrace)]
@@ -221,30 +215,9 @@ pub enum Error {
source: datatypes::error::Error,
},
#[snafu(display("Failed to serialize or deserialize catalog entry: {}", source))]
CatalogEntrySerde {
#[snafu(backtrace)]
source: common_catalog::error::Error,
},
#[snafu(display("Illegal access to catalog: {} and schema: {}", catalog, schema))]
QueryAccessDenied { catalog: String, schema: String },
#[snafu(display(
"Failed to get region stats, catalog: {}, schema: {}, table: {}, source: {}",
catalog,
schema,
table,
source
))]
RegionStats {
catalog: String,
schema: String,
table: String,
#[snafu(backtrace)]
source: table::error::Error,
},
#[snafu(display("Invalid system table definition: {err_msg}"))]
InvalidSystemTableDef { err_msg: String, location: Location },
@@ -285,9 +258,7 @@ impl ErrorExt for Error {
Error::ReadSystemCatalog { source, .. } | Error::CreateRecordBatch { source } => {
source.status_code()
}
Error::InvalidCatalogValue { source, .. } | Error::CatalogEntrySerde { source } => {
source.status_code()
}
Error::InvalidCatalogValue { source, .. } => source.status_code(),
Error::TableExists { .. } => StatusCode::TableAlreadyExists,
Error::TableNotExist { .. } => StatusCode::TableNotFound,
@@ -301,7 +272,6 @@ impl ErrorExt for Error {
| Error::OpenTable { source, .. }
| Error::CreateTable { source, .. }
| Error::DeregisterTable { source, .. }
| Error::RegionStats { source, .. }
| Error::TableSchemaMismatch { source } => source.status_code(),
Error::MetaSrv { source, .. } => source.status_code(),
@@ -309,9 +279,9 @@ impl ErrorExt for Error {
Error::SystemCatalogTableScanExec { source } => source.status_code(),
Error::InvalidTableInfoInCatalog { source } => source.status_code(),
Error::CompileScriptInternal { source }
| Error::SchemaProviderOperation { source }
| Error::Internal { source } => source.status_code(),
Error::CompileScriptInternal { source } | Error::Internal { source } => {
source.status_code()
}
Error::Unimplemented { .. } | Error::NotSupported { .. } => StatusCode::Unsupported,
Error::QueryAccessDenied { .. } => StatusCode::AccessDenied,

View File

@@ -64,13 +64,6 @@ pub enum Error {
source: meta_srv::error::Error,
},
#[snafu(display("Failed to read config file: {}, source: {}", path, source))]
ReadConfig {
path: String,
source: std::io::Error,
location: Location,
},
#[snafu(display("Missing config, msg: {}", msg))]
MissingConfig { msg: String, location: Location },
@@ -175,8 +168,7 @@ impl ErrorExt for Error {
Error::ShutdownMetaServer { source } => source.status_code(),
Error::BuildMetaServer { source } => source.status_code(),
Error::UnsupportedSelectorType { source, .. } => source.status_code(),
Error::ReadConfig { .. }
| Error::MissingConfig { .. }
Error::MissingConfig { .. }
| Error::LoadLayeredConfig { .. }
| Error::IllegalConfig { .. }
| Error::InvalidReplCommand { .. }

View File

@@ -36,9 +36,6 @@ pub enum Error {
location: Location,
source: serde_json::error::Error,
},
#[snafu(display("Failed to parse node id: {}", key))]
ParseNodeId { key: String, location: Location },
}
impl ErrorExt for Error {
@@ -47,7 +44,6 @@ impl ErrorExt for Error {
Error::InvalidCatalog { .. }
| Error::DeserializeCatalogEntryValue { .. }
| Error::SerializeCatalogEntryValue { .. } => StatusCode::Unexpected,
Error::ParseNodeId { .. } => StatusCode::InvalidArguments,
}
}

View File

@@ -41,9 +41,6 @@ pub enum Error {
#[snafu(display("empty host: {}", url))]
EmptyHostPath { url: String, location: Location },
#[snafu(display("Invalid path: {}", path))]
InvalidPath { path: String, location: Location },
#[snafu(display("Invalid url: {}, error :{}", url, source))]
InvalidUrl {
url: String,
@@ -51,12 +48,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Failed to decompression, source: {}", source))]
Decompression {
source: object_store::Error,
location: Location,
},
#[snafu(display("Failed to build backend, source: {}", source))]
BuildBackend {
source: object_store::Error,
@@ -148,9 +139,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Missing required field: {}", name))]
MissingRequiredField { name: String, location: Location },
#[snafu(display("Buffered writer closed"))]
BufferedWriterClosed { location: Location },
}
@@ -173,16 +161,13 @@ impl ErrorExt for Error {
| InvalidConnection { .. }
| InvalidUrl { .. }
| EmptyHostPath { .. }
| InvalidPath { .. }
| InferSchema { .. }
| ReadParquetSnafu { .. }
| ParquetToSchema { .. }
| ParseFormat { .. }
| MergeSchema { .. }
| MissingRequiredField { .. } => StatusCode::InvalidArguments,
| MergeSchema { .. } => StatusCode::InvalidArguments,
Decompression { .. }
| JoinHandle { .. }
JoinHandle { .. }
| ReadRecordBatch { .. }
| WriteRecordBatch { .. }
| EncodeRecordBatch { .. }
@@ -203,11 +188,9 @@ impl ErrorExt for Error {
InferSchema { location, .. } => Some(*location),
ReadParquetSnafu { location, .. } => Some(*location),
ParquetToSchema { location, .. } => Some(*location),
Decompression { location, .. } => Some(*location),
JoinHandle { location, .. } => Some(*location),
ParseFormat { location, .. } => Some(*location),
MergeSchema { location, .. } => Some(*location),
MissingRequiredField { location, .. } => Some(*location),
WriteObject { location, .. } => Some(*location),
ReadRecordBatch { location, .. } => Some(*location),
WriteRecordBatch { location, .. } => Some(*location),
@@ -217,7 +200,6 @@ impl ErrorExt for Error {
UnsupportedBackendProtocol { location, .. } => Some(*location),
EmptyHostPath { location, .. } => Some(*location),
InvalidPath { location, .. } => Some(*location),
InvalidUrl { location, .. } => Some(*location),
InvalidConnection { location, .. } => Some(*location),
UnsupportedCompressionType { location, .. } => Some(*location),

View File

@@ -14,7 +14,6 @@
use std::any::Any;
use api::DecodeError;
use common_error::ext::ErrorExt;
use common_error::prelude::{Snafu, StatusCode};
use snafu::Location;
@@ -28,9 +27,6 @@ pub enum Error {
table_name: String,
},
#[snafu(display("Failed to convert bytes to insert batch, source: {}", source))]
DecodeInsert { source: DecodeError },
#[snafu(display("Illegal delete request, reason: {reason}"))]
IllegalDeleteRequest { reason: String, location: Location },
@@ -65,12 +61,6 @@ pub enum Error {
#[snafu(display("Missing required field in protobuf, field: {}", field))]
MissingField { field: String, location: Location },
#[snafu(display("Invalid column default constraint, source: {}", source))]
ColumnDefaultConstraint {
#[snafu(backtrace)]
source: datatypes::error::Error,
},
#[snafu(display(
"Invalid column proto definition, column: {}, source: {}",
column,
@@ -102,9 +92,7 @@ impl ErrorExt for Error {
match self {
Error::ColumnNotFound { .. } => StatusCode::TableColumnNotFound,
Error::DecodeInsert { .. } | Error::IllegalDeleteRequest { .. } => {
StatusCode::InvalidArguments
}
Error::IllegalDeleteRequest { .. } => StatusCode::InvalidArguments,
Error::ColumnDataType { .. } => StatusCode::Internal,
Error::DuplicatedTimestampColumn { .. } | Error::MissingTimestampColumn { .. } => {
@@ -113,7 +101,6 @@ impl ErrorExt for Error {
Error::InvalidColumnProto { .. } => StatusCode::InvalidArguments,
Error::CreateVector { .. } => StatusCode::InvalidArguments,
Error::MissingField { .. } => StatusCode::InvalidArguments,
Error::ColumnDefaultConstraint { source, .. } => source.status_code(),
Error::InvalidColumnDef { source, .. } => source.status_code(),
Error::UnrecognizedTableOption { .. } => StatusCode::InvalidArguments,
Error::UnexpectedValuesLength { .. } | Error::ColumnAlreadyExists { .. } => {

View File

@@ -32,9 +32,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Missing required field in protobuf, field: {}", field))]
MissingField { field: String, location: Location },
#[snafu(display(
"Write type mismatch, column name: {}, expected: {}, actual: {}",
column_name,
@@ -63,12 +60,6 @@ pub enum Error {
#[snafu(display("Failed to convert Arrow type: {}", from))]
Conversion { from: String, location: Location },
#[snafu(display("Column datatype error, source: {}", source))]
ColumnDataType {
#[snafu(backtrace)]
source: api::error::Error,
},
#[snafu(display("Failed to decode FlightData, source: {}", source))]
DecodeFlightData {
source: api::DecodeError,
@@ -90,7 +81,6 @@ impl ErrorExt for Error {
match self {
Error::InvalidTlsConfig { .. }
| Error::InvalidConfigFilePath { .. }
| Error::MissingField { .. }
| Error::TypeMismatch { .. }
| Error::InvalidFlightData { .. } => StatusCode::InvalidArguments,
@@ -99,7 +89,6 @@ impl ErrorExt for Error {
| Error::DecodeFlightData { .. } => StatusCode::Internal,
Error::CreateRecordBatch { source } => source.status_code(),
Error::ColumnDataType { source } => source.status_code(),
Error::ConvertArrowSchema { source } => source.status_code(),
}
}

View File

@@ -76,12 +76,6 @@ pub enum Error {
source: BoxedError,
},
#[snafu(display("Failed to read {}, source: {}", key, source))]
ReadState {
key: String,
source: object_store::Error,
},
#[snafu(display("Failed to deserialize from json, source: {}", source))]
FromJson {
source: serde_json::Error,
@@ -147,7 +141,6 @@ impl ErrorExt for Error {
Error::ToJson { .. }
| Error::DeleteState { .. }
| Error::ReadState { .. }
| Error::FromJson { .. }
| Error::RetryTimesExceeded { .. }
| Error::RetryLater { .. }

View File

@@ -115,12 +115,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Failed to execute DataFusion ExecutionPlan, source: {}", source))]
DataFusionExecutionPlan {
source: DataFusionError,
location: Location,
},
#[snafu(display(
"Failed to convert DataFusion's recordbatch stream, source: {}",
source
@@ -198,9 +192,9 @@ impl ErrorExt for Error {
| Error::ConvertArrowSchema { source }
| Error::FromArrowArray { source } => source.status_code(),
Error::ExecuteRepeatedly { .. }
| Error::GeneralDataFusion { .. }
| Error::DataFusionExecutionPlan { .. } => StatusCode::Unexpected,
Error::ExecuteRepeatedly { .. } | Error::GeneralDataFusion { .. } => {
StatusCode::Unexpected
}
Error::UnsupportedInputDataType { .. }
| Error::TypeCast { .. }

View File

@@ -78,9 +78,6 @@ pub enum Error {
source: BoxedError,
},
#[snafu(display("Table querying not found: {}", name))]
TableNotFound { name: String, location: Location },
#[snafu(display("Cannot convert plan doesn't belong to GreptimeDB"))]
UnknownPlan { location: Location },
@@ -139,7 +136,6 @@ impl ErrorExt for Error {
| Error::EmptyExpr { .. }
| Error::MissingField { .. }
| Error::InvalidParameters { .. }
| Error::TableNotFound { .. }
| Error::SchemaNotMatch { .. } => StatusCode::InvalidArguments,
Error::DFInternal { .. }
| Error::Internal { .. }

View File

@@ -18,7 +18,6 @@ use common_error::prelude::*;
use common_procedure::ProcedureId;
use serde_json::error::Error as JsonError;
use snafu::Location;
use storage::error::Error as StorageError;
use store_api::storage::RegionNumber;
use table::error::Error as TableError;
@@ -109,20 +108,6 @@ pub enum Error {
source: TableError,
},
#[snafu(display("Failed to get table: {}, source: {}", table_name, source))]
GetTable {
table_name: String,
#[snafu(backtrace)]
source: TableError,
},
#[snafu(display("Failed to alter table {}, source: {}", table_name, source))]
AlterTable {
table_name: String,
#[snafu(backtrace)]
source: TableError,
},
#[snafu(display("Failed to drop table {}, source: {}", table_name, source))]
DropTable {
table_name: String,
@@ -216,15 +201,6 @@ pub enum Error {
source: std::net::AddrParseError,
},
#[snafu(display("Failed to bind address {}, source: {}", addr, source))]
TcpBind {
addr: String,
source: std::io::Error,
},
#[snafu(display("Failed to start gRPC server, source: {}", source))]
StartGrpc { source: tonic::transport::Error },
#[snafu(display("Failed to create directory {}, source: {}", dir, source))]
CreateDir { dir: String, source: std::io::Error },
@@ -237,9 +213,6 @@ pub enum Error {
source: log_store::error::Error,
},
#[snafu(display("Failed to storage engine, source: {}", source))]
OpenStorageEngine { source: StorageError },
#[snafu(display("Failed to init backend, source: {}", source))]
InitBackend {
source: object_store::Error,
@@ -258,12 +231,6 @@ pub enum Error {
#[snafu(display("Not support SQL, error: {}", msg))]
NotSupportSql { msg: String },
#[snafu(display("Failed to convert datafusion schema, source: {}", source))]
ConvertSchema {
#[snafu(backtrace)]
source: datatypes::error::Error,
},
#[snafu(display("Specified timestamp key or primary key column not found: {}", name))]
KeyColumnNotFound { name: String, location: Location },
@@ -279,18 +246,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Failed to insert into system catalog table, source: {}", source))]
InsertSystemCatalog {
#[snafu(backtrace)]
source: catalog::error::Error,
},
#[snafu(display("Failed to rename table, source: {}", source))]
RenameTable {
#[snafu(backtrace)]
source: catalog::error::Error,
},
#[snafu(display("Failed to register a new schema, source: {}", source))]
RegisterSchema {
#[snafu(backtrace)]
@@ -335,12 +290,6 @@ pub enum Error {
source: common_time::error::Error,
},
#[snafu(display("Failed to infer schema: {}", source))]
InferSchema {
#[snafu(backtrace)]
source: query::error::Error,
},
#[snafu(display("Failed to prepare immutable table: {}", source))]
PrepareImmutableTable {
#[snafu(backtrace)]
@@ -383,12 +332,6 @@ pub enum Error {
source: table::error::Error,
},
#[snafu(display("Failed to do vector computation, source: {}", source))]
VectorComputation {
#[snafu(backtrace)]
source: datatypes::error::Error,
},
#[snafu(display("Missing node id option in distributed mode"))]
MissingNodeId { location: Location },
@@ -418,12 +361,6 @@ pub enum Error {
))]
ColumnNoneDefaultValue { column: String, location: Location },
#[snafu(display("Failed to describe schema for given statement, source: {}", source))]
DescribeStatement {
#[snafu(backtrace)]
source: query::error::Error,
},
#[snafu(display("Unrecognized table option: {}", source))]
UnrecognizedTableOption {
#[snafu(backtrace)]
@@ -503,8 +440,7 @@ impl ErrorExt for Error {
ExecuteSql { source }
| PlanStatement { source }
| ExecuteStatement { source }
| ExecuteLogicalPlan { source }
| DescribeStatement { source } => source.status_code(),
| ExecuteLogicalPlan { source } => source.status_code(),
OpenTable { source, .. } => source.status_code(),
RegisterTable { source, .. } | AccessCatalog { source, .. } => source.status_code(),
@@ -512,10 +448,7 @@ impl ErrorExt for Error {
DecodeLogicalPlan { source } => source.status_code(),
NewCatalog { source } | RegisterSchema { source } => source.status_code(),
FindTable { source, .. } => source.status_code(),
CreateTable { source, .. }
| GetTable { source, .. }
| AlterTable { source, .. }
| CheckRegion { source, .. } => source.status_code(),
CreateTable { source, .. } | CheckRegion { source, .. } => source.status_code(),
DropTable { source, .. } => source.status_code(),
FlushTable { source, .. } => source.status_code(),
@@ -534,10 +467,6 @@ impl ErrorExt for Error {
| DeleteExprToRequest { source }
| InsertData { source } => source.status_code(),
ConvertSchema { source, .. } | VectorComputation { source } => source.status_code(),
InferSchema { source, .. } => source.status_code(),
ColumnValuesNumberMismatch { .. }
| InvalidSql { .. }
| NotSupportSql { .. }
@@ -563,12 +492,8 @@ impl ErrorExt for Error {
// TODO(yingwen): Further categorize http error.
StartServer { .. }
| ParseAddr { .. }
| TcpBind { .. }
| StartGrpc { .. }
| CreateDir { .. }
| RemoveDir { .. }
| InsertSystemCatalog { .. }
| RenameTable { .. }
| Catalog { .. }
| MissingRequiredField { .. }
| IncorrectInternalState { .. }
@@ -580,7 +505,6 @@ impl ErrorExt for Error {
InitBackend { .. } => StatusCode::StorageUnavailable,
OpenLogStore { source } => source.status_code(),
OpenStorageEngine { source } => source.status_code(),
RuntimeResource { .. } => StatusCode::RuntimeResourcesExhausted,
MetaClientInit { source, .. } => source.status_code(),
TableIdProviderNotFound { .. } => StatusCode::Unsupported,

View File

@@ -59,9 +59,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Timestamp column {} not found", name,))]
TimestampNotFound { name: String, location: Location },
#[snafu(display(
"Failed to parse version in schema meta, value: {}, source: {}",
value,

View File

@@ -134,9 +134,6 @@ pub enum Error {
source: common_datasource::error::Error,
},
#[snafu(display("Unsupported file format: {}", format))]
UnsupportedFileFormat { format: String, location: Location },
#[snafu(display("Failed to build csv config: {}", source))]
BuildCsvConfig {
source: common_datasource::file_format::csv::CsvConfigBuilderError,
@@ -191,7 +188,6 @@ impl ErrorExt for Error {
| BuildTableMeta { .. }
| BuildTableInfo { .. }
| InvalidRawSchema { .. }
| UnsupportedFileFormat { .. }
| BuildCsvConfig { .. }
| ProjectSchema { .. }
| MissingRequiredField { .. }

View File

@@ -73,9 +73,6 @@ pub enum Error {
source: sql::error::Error,
},
#[snafu(display("Missing insert values"))]
MissingInsertValues { location: Location },
#[snafu(display("Column datatype error, source: {}", source))]
ColumnDataType {
#[snafu(backtrace)]
@@ -107,9 +104,6 @@ pub enum Error {
#[snafu(display("Invalid SQL, error: {}", err_msg))]
InvalidSql { err_msg: String, location: Location },
#[snafu(display("Illegal Frontend state: {}", err_msg))]
IllegalFrontendState { err_msg: String, location: Location },
#[snafu(display("Incomplete GRPC result: {}", err_msg))]
IncompleteGrpcResult { err_msg: String, location: Location },
@@ -128,24 +122,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Column {} not found in table {}", column_name, table_name))]
ColumnNotFound {
column_name: String,
table_name: String,
location: Location,
},
#[snafu(display(
"Columns and values number mismatch, columns: {}, values: {}",
columns,
values,
))]
ColumnValuesNumberMismatch {
columns: usize,
values: usize,
location: Location,
},
#[snafu(display("Failed to join task, source: {}", source))]
JoinTask {
source: common_runtime::JoinError,
@@ -356,12 +332,6 @@ pub enum Error {
source: datatypes::error::Error,
},
#[snafu(display(
"No valid default value can be built automatically, column: {}",
column,
))]
ColumnNoneDefaultValue { column: String, location: Location },
#[snafu(display("SQL execution intercepted, source: {}", source))]
SqlExecIntercepted {
#[snafu(backtrace)]
@@ -557,15 +527,12 @@ impl ErrorExt for Error {
Error::ParseAddr { .. }
| Error::InvalidSql { .. }
| Error::InvalidInsertRequest { .. }
| Error::ColumnValuesNumberMismatch { .. }
| Error::IllegalPrimaryKeysDef { .. }
| Error::CatalogNotFound { .. }
| Error::SchemaNotFound { .. }
| Error::SchemaExists { .. }
| Error::MissingInsertValues { .. }
| Error::PrimaryKeyNotFound { .. }
| Error::MissingMetasrvOpts { .. }
| Error::ColumnNoneDefaultValue { .. }
| Error::BuildRegex { .. }
| Error::InvalidSchema { .. }
| Error::PrepareImmutableTable { .. }
@@ -609,13 +576,11 @@ impl ErrorExt for Error {
| Error::BuildDfLogicalPlan { .. }
| Error::BuildTableMeta { .. } => StatusCode::Internal,
Error::IllegalFrontendState { .. }
| Error::IncompleteGrpcResult { .. }
Error::IncompleteGrpcResult { .. }
| Error::ContextValueNotFound { .. }
| Error::EncodeJson { .. } => StatusCode::Unexpected,
Error::TableNotFound { .. } => StatusCode::TableNotFound,
Error::ColumnNotFound { .. } => StatusCode::TableColumnNotFound,
Error::JoinTask { .. }
| Error::BuildParquetRecordBatchStream { .. }

View File

@@ -18,13 +18,6 @@ use snafu::Location;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum Error {
#[snafu(display("Failed to connect to {}, source: {}", url, source))]
ConnectFailed {
url: String,
source: tonic::transport::Error,
location: Location,
},
#[snafu(display("Illegal GRPC client state: {}", err_msg))]
IllegalGrpcClientState { err_msg: String, location: Location },
@@ -84,8 +77,7 @@ impl ErrorExt for Error {
fn status_code(&self) -> StatusCode {
match self {
Error::ConnectFailed { .. }
| Error::IllegalGrpcClientState { .. }
Error::IllegalGrpcClientState { .. }
| Error::TonicStatus { .. }
| Error::AskLeader { .. }
| Error::NoLeader { .. }

View File

@@ -33,9 +33,6 @@ pub enum Error {
server: String,
},
#[snafu(display("Error stream request next is None"))]
StreamNone { location: Location },
#[snafu(display("Empty key is not allowed"))]
EmptyKey { location: Location },
@@ -187,12 +184,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Failed to decode table global value, source: {}", source))]
DecodeTableGlobalValue {
source: prost::DecodeError,
location: Location,
},
#[snafu(display("Unexpected, violated: {}", violated))]
Unexpected {
violated: String,
@@ -259,12 +250,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("An error occurred in Meta, source: {}", source))]
MetaInternal {
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display("Failed to lock based on etcd, source: {}", source))]
Lock {
source: etcd_client::Error,
@@ -385,14 +370,12 @@ impl ErrorExt for Error {
fn status_code(&self) -> StatusCode {
match self {
Error::StreamNone { .. }
| Error::EtcdFailed { .. }
Error::EtcdFailed { .. }
| Error::ConnectEtcd { .. }
| Error::TcpBind { .. }
| Error::SerializeToJson { .. }
| Error::DeserializeFromJson { .. }
| Error::DecodeTableRoute { .. }
| Error::DecodeTableGlobalValue { .. }
| Error::NoLeader { .. }
| Error::CreateChannel { .. }
| Error::BatchGet { .. }
@@ -442,7 +425,6 @@ impl ErrorExt for Error {
| Error::Unexpected { .. } => StatusCode::Unexpected,
Error::TableNotFound { .. } => StatusCode::TableNotFound,
Error::InvalidCatalogValue { source, .. } => source.status_code(),
Error::MetaInternal { source } => source.status_code(),
Error::RecoverProcedure { source } => source.status_code(),
Error::ShutdownServer { source, .. } | Error::StartHttp { source } => {
source.status_code()

View File

@@ -14,7 +14,6 @@
use std::any::Any;
use common_error::ext::BoxedError;
use common_error::prelude::*;
use snafu::Location;
use store_api::storage::RegionNumber;
@@ -23,12 +22,6 @@ use table::metadata::{TableInfoBuilderError, TableMetaBuilderError, TableVersion
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum Error {
#[snafu(display("Failed to create region, source: {}", source))]
CreateRegion {
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display(
"Failed to build table meta for table: {}, source: {}",
table_name,
@@ -130,12 +123,6 @@ pub enum Error {
table_name: String,
},
#[snafu(display("Table info not found in manifest, table: {}", table_name))]
TableInfoNotFound {
location: Location,
table_name: String,
},
#[snafu(display("Table already exists: {}", table_name))]
TableExists {
location: Location,
@@ -148,13 +135,6 @@ pub enum Error {
table_name: String,
},
#[snafu(display("Failed to alter table {}, source: {}", table_name, source))]
AlterTable {
table_name: String,
#[snafu(backtrace)]
source: table::error::Error,
},
#[snafu(display(
"Projected column not found in region, column: {}",
column_qualified_name
@@ -180,12 +160,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Invalid region name: {}", region_name))]
InvalidRegionName {
region_name: String,
location: Location,
},
#[snafu(display("Invalid schema, source: {}", source))]
InvalidRawSchema { source: datatypes::error::Error },
@@ -203,10 +177,6 @@ impl ErrorExt for Error {
use Error::*;
match self {
CreateRegion { source, .. } => source.status_code(),
AlterTable { source, .. } => source.status_code(),
BuildRowKeyDescriptor { .. }
| BuildColumnDescriptor { .. }
| BuildColumnFamilyDescriptor { .. }
@@ -221,11 +191,10 @@ impl ErrorExt for Error {
| InvalidRawSchema { .. }
| VersionChanged { .. } => StatusCode::InvalidArguments,
TableInfoNotFound { .. } | ConvertRaw { .. } => StatusCode::Unexpected,
ConvertRaw { .. } => StatusCode::Unexpected,
ScanTableManifest { .. } | UpdateTableManifest { .. } => StatusCode::StorageUnavailable,
RegionNotFound { .. } => StatusCode::Internal,
InvalidRegionName { .. } => StatusCode::Internal,
}
}

View File

@@ -49,12 +49,6 @@ pub enum Error {
#[snafu(display("Cannot find value columns in table {}", table))]
ValueNotFound { table: String, location: Location },
#[snafu(display("Cannot find the table {}", table))]
TableNotFound {
table: String,
source: datafusion::error::DataFusionError,
},
#[snafu(display(
"Cannot accept multiple vector as function input, PromQL expr: {:?}",
expr
@@ -120,7 +114,7 @@ impl ErrorExt for Error {
| IllegalRange { .. }
| EmptyRange { .. } => StatusCode::Internal,
TableNotFound { .. } | TableNameNotFound { .. } => StatusCode::TableNotFound,
TableNameNotFound { .. } => StatusCode::TableNotFound,
Catalog { source } => source.status_code(),
}

View File

@@ -160,9 +160,6 @@ pub enum Error {
source: common_datasource::error::Error,
},
#[snafu(display("Unsupported file format: {}", format))]
UnsupportedFileFormat { format: String, location: Location },
#[snafu(display("Failed to parse file format: {}", source))]
ParseFileFormat {
#[snafu(backtrace)]
@@ -197,7 +194,6 @@ impl ErrorExt for Error {
| ParseFloat { .. }
| MissingRequiredField { .. }
| BuildRegex { .. }
| UnsupportedFileFormat { .. }
| ConvertSchema { .. } => StatusCode::InvalidArguments,
BuildBackend { .. } | ListObjects { .. } => StatusCode::StorageUnavailable,

View File

@@ -103,9 +103,6 @@ pub enum Error {
location: SnafuLocation,
},
#[snafu(display("Missing sql in coprocessor"))]
MissingSql { location: SnafuLocation },
#[snafu(display("Failed to retrieve record batches, source: {}", source))]
RecordBatch {
#[snafu(backtrace)]
@@ -145,8 +142,7 @@ impl ErrorExt for Error {
Error::PyParse { .. }
| Error::PyCompile { .. }
| Error::CoprParse { .. }
| Error::UnsupportedSql { .. }
| Error::MissingSql { .. } => StatusCode::InvalidArguments,
| Error::UnsupportedSql { .. } => StatusCode::InvalidArguments,
}
}

View File

@@ -80,12 +80,6 @@ pub enum Error {
source: BoxedError,
},
#[snafu(display("Failed to execute sql statement, source: {}", source))]
ExecuteStatement {
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display("Failed to check database validity, source: {}", source))]
CheckDatabaseValidity {
#[snafu(backtrace)]
@@ -95,13 +89,6 @@ pub enum Error {
#[snafu(display("Failed to describe statement, source: {}", source))]
DescribeStatement { source: BoxedError },
#[snafu(display("Failed to execute alter: {}, source: {}", query, source))]
ExecuteAlter {
query: String,
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display("Failed to insert script with name: {}, source: {}", name, source))]
InsertScript {
name: String,
@@ -155,17 +142,6 @@ pub enum Error {
location: Location,
},
#[snafu(display(
"Failed to put OpenTSDB data point: {:?}, source: {}",
data_point,
source
))]
PutOpentsdbDataPoint {
data_point: String,
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display("Failed to decode prometheus remote request, source: {}", source))]
DecodePromRemoteRequest {
location: Location,
@@ -190,15 +166,6 @@ pub enum Error {
location: Location,
},
#[snafu(display("Failed to start frontend service, source: {}", source))]
StartFrontend {
#[snafu(backtrace)]
source: BoxedError,
},
#[snafu(display("Failed to build context, msg: {}", err_msg))]
BuildingContext { err_msg: String, location: Location },
#[snafu(display("Tls is required for {}, plain connection is rejected", server))]
TlsRequired { server: String },
@@ -241,12 +208,6 @@ pub enum Error {
#[snafu(display("Error accessing catalog: {}", source))]
CatalogError { source: catalog::error::Error },
#[snafu(display("Failed to convert Flight Message, source: {}", source))]
ConvertFlightMessage {
#[snafu(backtrace)]
source: common_grpc::error::Error,
},
#[snafu(display("Cannot find requested database: {}-{}", catalog, schema))]
DatabaseNotFound { catalog: String, schema: String },
@@ -303,17 +264,13 @@ impl ErrorExt for Error {
| TcpBind { .. }
| CatalogError { .. }
| GrpcReflectionService { .. }
| BuildingContext { .. }
| BuildHttpResponse { .. } => StatusCode::Internal,
InsertScript { source, .. }
| ExecuteScript { source, .. }
| ExecuteQuery { source, .. }
| ExecuteGrpcQuery { source, .. }
| ExecuteStatement { source, .. }
| CheckDatabaseValidity { source, .. }
| ExecuteAlter { source, .. }
| PutOpentsdbDataPoint { source, .. } => source.status_code(),
| CheckDatabaseValidity { source, .. } => source.status_code(),
NotSupported { .. }
| InvalidQuery { .. }
@@ -328,13 +285,10 @@ impl ErrorExt for Error {
| InvalidPrepareStatement { .. }
| TimePrecision { .. } => StatusCode::InvalidArguments,
InfluxdbLinesWrite { source, .. } | ConvertFlightMessage { source } => {
source.status_code()
}
InfluxdbLinesWrite { source, .. } => source.status_code(),
Hyper { .. } => StatusCode::Unknown,
TlsRequired { .. } => StatusCode::Unknown,
StartFrontend { source, .. } => source.status_code(),
Auth { source, .. } => source.status_code(),
DescribeStatement { source } => source.status_code(),

View File

@@ -20,7 +20,6 @@ use common_time::Timestamp;
use datatypes::prelude::{ConcreteDataType, Value};
use snafu::Location;
use sqlparser::parser::ParserError;
use sqlparser::tokenizer::TokenizerError;
use crate::ast::{Expr, Value as SqlValue};
@@ -60,9 +59,6 @@ pub enum Error {
#[snafu(display("Syntax error, sql: {}, source: {}", sql, source))]
Syntax { sql: String, source: ParserError },
#[snafu(display("Tokenizer error, sql: {}, source: {}", sql, source))]
Tokenizer { sql: String, source: TokenizerError },
#[snafu(display("Missing time index constraint"))]
MissingTimeIndex {},
@@ -106,9 +102,6 @@ pub enum Error {
source: datatypes::error::Error,
},
#[snafu(display("Unsupported ALTER TABLE statement: {}", msg))]
UnsupportedAlterTableStatement { msg: String },
#[snafu(display("Failed to serialize column default constraint, source: {}", source))]
SerializeColumnDefaultConstraint {
#[snafu(backtrace)]
@@ -164,7 +157,6 @@ impl ErrorExt for Error {
| Syntax { .. }
| MissingTimeIndex { .. }
| InvalidTimeIndex { .. }
| Tokenizer { .. }
| InvalidSql { .. }
| ParseSqlValue { .. }
| SqlTypeNotSupported { .. }
@@ -177,7 +169,6 @@ impl ErrorExt for Error {
| InvalidSqlValue { .. }
| TimestampOverflow { .. } => StatusCode::InvalidArguments,
UnsupportedAlterTableStatement { .. } => StatusCode::InvalidSyntax,
SerializeColumnDefaultConstraint { source, .. } => source.status_code(),
ConvertToGrpcDataType { source, .. } => source.status_code(),
ConvertToDfStatement { .. } => StatusCode::Internal,

View File

@@ -522,12 +522,6 @@ pub enum Error {
source: ArrowError,
location: Location,
},
#[snafu(display("Failed to sort arrays, source: {}", source))]
SelectRows {
source: ArrowError,
location: Location,
},
}
pub type Result<T> = std::result::Result<T, Error>;
@@ -627,7 +621,6 @@ impl ErrorExt for Error {
TtlCalculation { source, .. } => source.status_code(),
ConvertColumnsToRows { .. } | SortArrays { .. } => StatusCode::Unexpected,
SelectRows { .. } => StatusCode::Unexpected,
}
}

View File

@@ -19,7 +19,6 @@ use common_recordbatch::error::Error as RecordBatchError;
use datafusion::error::DataFusionError;
use datatypes::arrow::error::ArrowError;
use snafu::Location;
use store_api::storage::RegionNumber;
use crate::metadata::TableId;
@@ -29,21 +28,12 @@ pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum Error {
#[snafu(display("Failed to downcast mito table"))]
DowncastMitoTable { location: Location },
#[snafu(display("Datafusion error: {}", source))]
Datafusion {
source: DataFusionError,
location: Location,
},
#[snafu(display("Poll stream failed, source: {}", source))]
PollStream {
source: ArrowError,
location: Location,
},
#[snafu(display("Failed to convert Arrow schema, source: {}", source))]
SchemaConversion {
source: datatypes::error::Error,
@@ -119,13 +109,6 @@ pub enum Error {
#[snafu(display("Failed to operate table, source: {}", source))]
TableOperation { source: BoxedError },
#[snafu(display("Cannot find region, table: {}, region: {}", table, region))]
RegionNotFound {
table: String,
region: RegionNumber,
location: Location,
},
#[snafu(display("Unsupported operation: {}", operation))]
Unsupported { operation: String },
@@ -153,7 +136,6 @@ impl ErrorExt for Error {
fn status_code(&self) -> StatusCode {
match self {
Error::Datafusion { .. }
| Error::PollStream { .. }
| Error::SchemaConversion { .. }
| Error::TableProjection { .. } => StatusCode::EngineExecuteQuery,
Error::RemoveColumnInIndex { .. } | Error::BuildColumnDescriptor { .. } => {
@@ -170,10 +152,9 @@ impl ErrorExt for Error {
| Error::EngineNotFound { .. }
| Error::EngineExist { .. } => StatusCode::InvalidArguments,
Error::InvalidTable { .. }
| Error::MissingTimeIndexColumn { .. }
| Error::RegionNotFound { .. }
| Error::DowncastMitoTable { .. } => StatusCode::Internal,
Error::InvalidTable { .. } | Error::MissingTimeIndexColumn { .. } => {
StatusCode::Internal
}
}
}