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
+2 -78
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,