Skip to content

Commit

Permalink
refactor: remove location pt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
shuiyisong committed Sep 18, 2023
1 parent 76e1a86 commit 63749af
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 154 deletions.
2 changes: 1 addition & 1 deletion src/client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum Error {
source: BoxedError,
},

#[snafu(display("Failure occurs during handling request, location: {}", location))]
#[snafu(display("Failure occurs during handling request"))]
HandleRequest {
location: Location,
source: BoxedError,
Expand Down
4 changes: 2 additions & 2 deletions src/common/meta/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub enum Error {
source: common_procedure::Error,
},

#[snafu(display("Unsupported operation {}, location: {}", operation, location))]
#[snafu(display("Unsupported operation {}", operation))]
Unsupported {
operation: String,
location: Location,
Expand Down Expand Up @@ -226,7 +226,7 @@ pub enum Error {
source: BoxedError,
},

#[snafu(display("Invalid heartbeat response, location: {}", location))]
#[snafu(display("Invalid heartbeat response"))]
InvalidHeartbeatResponse { location: Location },

#[snafu(display("Failed to operate on datanode: {}", peer))]
Expand Down
2 changes: 1 addition & 1 deletion src/common/recordbatch/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub enum Error {
source: datatypes::error::Error,
},

#[snafu(display("External error, location: {}", location))]
#[snafu(display("External error"))]
External {
location: Location,
source: BoxedError,
Expand Down
31 changes: 11 additions & 20 deletions src/datanode/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub enum Error {
#[snafu(display("Expect KvBackend but not found"))]
MissingKvBackend { location: Location },

#[snafu(display("Expect MetaClient but not found, location: {}", location))]
#[snafu(display("Expect MetaClient but not found"))]
MissingMetaClient { location: Location },

#[snafu(display("Invalid SQL, error: {}", msg))]
Expand Down Expand Up @@ -280,10 +280,10 @@ pub enum Error {
source: table::error::Error,
},

#[snafu(display("Missing node id in Datanode config, location: {}", location))]
#[snafu(display("Missing node id in Datanode config"))]
MissingNodeId { location: Location },

#[snafu(display("Missing node id option in distributed mode, location: {}", location))]
#[snafu(display("Missing node id option in distributed mode"))]
MissingMetasrvOpts { location: Location },

#[snafu(display("Missing required field: {}", name))]
Expand Down Expand Up @@ -367,44 +367,35 @@ pub enum Error {
location: Location,
},

#[snafu(display(
"Failed to handle request for region {}, location: {}",
region_id,
location
))]
#[snafu(display("Failed to handle request for region {}", region_id))]
HandleRegionRequest {
region_id: RegionId,
location: Location,
source: BoxedError,
},

#[snafu(display("RegionId {} not found, location: {}", region_id, location))]
#[snafu(display("RegionId {} not found", region_id))]
RegionNotFound {
region_id: RegionId,
location: Location,
},

#[snafu(display("Region engine {} is not registered, location: {}", name, location))]
#[snafu(display("Region engine {} is not registered", name))]
RegionEngineNotFound { name: String, location: Location },

#[snafu(display("Unsupported gRPC request, kind: {}, location: {}", kind, location))]
#[snafu(display("Unsupported gRPC request, kind: {}", kind))]
UnsupportedGrpcRequest { kind: String, location: Location },

#[snafu(display(
"Unsupported output type, expected: {}, location: {}",
expected,
location
))]
#[snafu(display("Unsupported output type, expected: {}", expected))]
UnsupportedOutput {
expected: String,
location: Location,
},

#[snafu(display(
"Failed to get metadata from engine {} for region_id {}, location: {}",
"Failed to get metadata from engine {} for region_id {}",
engine,
region_id,
location,
))]
GetRegionMetadata {
engine: String,
Expand All @@ -413,13 +404,13 @@ pub enum Error {
source: BoxedError,
},

#[snafu(display("Failed to build region requests, location:{}", location))]
#[snafu(display("Failed to build region requests"))]
BuildRegionRequests {
location: Location,
source: store_api::metadata::MetadataError,
},

#[snafu(display("Failed to stop region engine {}, location:{}", name, location))]
#[snafu(display("Failed to stop region engine {}", name))]
StopRegionEngine {
name: String,
location: Location,
Expand Down
6 changes: 3 additions & 3 deletions src/meta-srv/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub enum Error {
#[snafu(display("Empty key is not allowed"))]
EmptyKey { location: Location },

#[snafu(display("Failed to execute via Etcd, location: {}", location))]
#[snafu(display("Failed to execute via Etcd"))]
EtcdFailed {
source: etcd_client::Error,
location: Location,
Expand Down Expand Up @@ -498,10 +498,10 @@ pub enum Error {
location: Location,
},

#[snafu(display("Too many partitions, location: {}", location))]
#[snafu(display("Too many partitions"))]
TooManyPartitions { location: Location },

#[snafu(display("Unsupported operation {}, location: {}", operation, location))]
#[snafu(display("Unsupported operation {}", operation))]
Unsupported {
operation: String,
location: Location,
Expand Down
Loading

0 comments on commit 63749af

Please sign in to comment.