Skip to content

Commit

Permalink
refactor: remove location pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
shuiyisong committed Sep 18, 2023
1 parent 63749af commit c76038a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 27 deletions.
7 changes: 2 additions & 5 deletions src/catalog/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub enum Error {
#[snafu(display("Operation {} not supported", op))]
NotSupported { op: String, location: Location },

#[snafu(display("Failed to open table {table_id} at {location}"))]
#[snafu(display("Failed to open table {table_id}"))]
OpenTable {
table_id: TableId,
location: Location,
Expand Down Expand Up @@ -180,10 +180,7 @@ pub enum Error {
source: BoxedError,
},

#[snafu(display(
"Failed to upgrade weak catalog manager reference. location: {}",
location
))]
#[snafu(display("Failed to upgrade weak catalog manager reference"))]
UpgradeWeakCatalogManagerRef { location: Location },

#[snafu(display("Failed to execute system catalog table scan"))]
Expand Down
6 changes: 3 additions & 3 deletions src/common/meta/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub enum Error {
source: datatypes::Error,
},

#[snafu(display("Primary key '{key}' not found when creating region request, at {location}"))]
#[snafu(display("Primary key '{key}' not found when creating region request"))]
PrimaryKeyNotFound { key: String, location: Location },

#[snafu(display("Failed to build table meta for table: {}", table_name))]
Expand Down Expand Up @@ -146,13 +146,13 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to convert alter table request, at {location}"))]
#[snafu(display("Failed to convert alter table request"))]
ConvertAlterTableRequest {
source: common_grpc_expr::error::Error,
location: Location,
},

#[snafu(display("Invalid protobuf message: {err_msg}, at {location}"))]
#[snafu(display("Invalid protobuf message: {err_msg}"))]
InvalidProtoMsg { err_msg: String, location: Location },

#[snafu(display("Unexpected: {err_msg}"))]
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub enum Error {
#[snafu(display("Invalid DeleteRequest, reason: {}", reason))]
InvalidDeleteRequest { reason: String, location: Location },

#[snafu(display("Invalid system table definition: {err_msg}, at {location}"))]
#[snafu(display("Invalid system table definition: {err_msg}"))]
InvalidSystemTableDef { err_msg: String, location: Location },

#[snafu(display("Table not found: {}", table_name))]
Expand Down
4 changes: 2 additions & 2 deletions src/meta-srv/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to find table route for {table_id}, at {location}"))]
#[snafu(display("Failed to find table route for {table_id}"))]
TableRouteNotFound {
table_id: TableId,
location: Location,
Expand Down Expand Up @@ -280,7 +280,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("Unexpected, violated: {violated}, at {location}"))]
#[snafu(display("Unexpected, violated: {violated}"))]
Unexpected {
violated: String,
location: Location,
Expand Down
16 changes: 5 additions & 11 deletions src/servers/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub enum Error {
source: query::error::Error,
},

#[snafu(display("Failed to get param types, location: {location}"))]
#[snafu(display("Failed to get param types"))]
GetPreparedStmtParams {
source: query::error::Error,
location: Location,
Expand Down Expand Up @@ -304,31 +304,25 @@ pub enum Error {
#[snafu(display(""))]
Metrics { source: BoxedError },

#[snafu(display("DataFrame operation error, location: {location}"))]
#[snafu(display("DataFrame operation error"))]
DataFrame {
source: datafusion::error::DataFusionError,
location: Location,
},

#[snafu(display(
"Failed to replace params with values in prepared statement, location: {location}"
))]
#[snafu(display("Failed to replace params with values in prepared statement"))]
ReplacePreparedStmtParams {
source: query::error::Error,
location: Location,
},

#[snafu(display("Failed to convert scalar value, location: {location}"))]
#[snafu(display("Failed to convert scalar value"))]
ConvertScalarValue {
source: datatypes::error::Error,
location: Location,
},

#[snafu(display(
"Expected type: {:?}, actual: {:?}, location: {location}",
expected,
actual
))]
#[snafu(display("Expected type: {:?}, actual: {:?}", expected, actual))]
PreparedStmtTypeMismatch {
expected: ConcreteDataType,
actual: opensrv_mysql::ColumnType,
Expand Down
2 changes: 1 addition & 1 deletion src/servers/src/metrics/jemalloc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use snafu::{Location, Snafu};
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum Error {
#[snafu(display("Failed to update jemalloc metrics, location: {location}"))]
#[snafu(display("Failed to update jemalloc metrics"))]
UpdateJemallocMetrics {
source: tikv_jemalloc_ctl::Error,
location: Location,
Expand Down
6 changes: 3 additions & 3 deletions src/store-api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ use crate::storage::ColumnDescriptorBuilderError;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum Error {
#[snafu(display("Invalid raw region request: {err}, at {location}"))]
#[snafu(display("Invalid raw region request: {err}"))]
InvalidRawRegionRequest { err: String, location: Location },

#[snafu(display("Invalid default constraint: {constraint}, at {location}"))]
#[snafu(display("Invalid default constraint: {constraint}"))]
InvalidDefaultConstraint {
constraint: String,
source: datatypes::error::Error,
location: Location,
},

#[snafu(display("Failed to build column descriptor: , at {location}"))]
#[snafu(display("Failed to build column descriptor: "))]
BuildColumnDescriptor {
source: ColumnDescriptorBuilderError,
location: Location,
Expand Down
2 changes: 1 addition & 1 deletion src/table/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub enum Error {
source: BoxedError,
},

#[snafu(display("Column {column_name} already exists in table {table_name}, at {location}"))]
#[snafu(display("Column {column_name} already exists in table {table_name}"))]
ColumnExists {
column_name: String,
table_name: String,
Expand Down

0 comments on commit c76038a

Please sign in to comment.