Skip to content

Commit

Permalink
refactor: remove source pt 3
Browse files Browse the repository at this point in the history
  • Loading branch information
shuiyisong committed Sep 18, 2023
1 parent 812055a commit 76e1a86
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 44 deletions.
2 changes: 1 addition & 1 deletion 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}, source: , at {location}"))]
#[snafu(display("Failed to open table {table_id} at {location}"))]
OpenTable {
table_id: TableId,
location: Location,
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub enum Error {
source: auth::error::Error,
},

#[snafu(display("Unsupported selector type, {} source", selector_type))]
#[snafu(display("Unsupported selector type: {}", selector_type))]
UnsupportedSelectorType {
selector_type: String,
location: Location,
Expand All @@ -111,20 +111,20 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to request database, sql: {sql}, source: "))]
#[snafu(display("Failed to request database, sql: {sql}"))]
RequestDatabase {
sql: String,
location: Location,
source: client::Error,
},

#[snafu(display("Failed to collect RecordBatches, source: "))]
#[snafu(display("Failed to collect RecordBatches"))]
CollectRecordBatches {
location: Location,
source: common_recordbatch::error::Error,
},

#[snafu(display("Failed to pretty print Recordbatches, source: "))]
#[snafu(display("Failed to pretty print Recordbatches"))]
PrettyPrintRecordBatches {
location: Location,
source: common_recordbatch::error::Error,
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 @@ -53,7 +53,7 @@ pub enum Error {
source: common_procedure::error::Error,
},

#[snafu(display("Failed to submit procedure, source: "))]
#[snafu(display("Failed to submit procedure"))]
SubmitProcedure {
location: Location,
source: common_procedure::Error,
Expand All @@ -65,7 +65,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to wait procedure done, source: "))]
#[snafu(display("Failed to wait procedure done"))]
WaitProcedure {
location: Location,
source: common_procedure::Error,
Expand Down Expand Up @@ -146,7 +146,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to convert alter table request, source: , at {location}"))]
#[snafu(display("Failed to convert alter table request, at {location}"))]
ConvertAlterTableRequest {
source: common_grpc_expr::error::Error,
location: Location,
Expand Down
12 changes: 4 additions & 8 deletions src/common/procedure/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to put state, key: '{key}', source: "))]
#[snafu(display("Failed to put state, key: '{key}'"))]
PutState {
key: String,
location: Location,
Expand All @@ -57,14 +57,14 @@ pub enum Error {
source: object_store::Error,
},

#[snafu(display("Failed to delete keys: '{keys}', source: "))]
#[snafu(display("Failed to delete keys: '{keys}'"))]
DeleteStates {
keys: String,
location: Location,
source: BoxedError,
},

#[snafu(display("Failed to list state, path: '{path}', source: "))]
#[snafu(display("Failed to list state, path: '{path}'"))]
ListState {
path: String,
location: Location,
Expand Down Expand Up @@ -95,11 +95,7 @@ pub enum Error {
location: Location,
},

#[snafu(display(
"Procedure retry exceeded max times, procedure_id: {}, source:{}",
procedure_id,
source
))]
#[snafu(display("Procedure retry exceeded max times, procedure_id: {}", procedure_id))]
RetryTimesExceeded {
source: Arc<Error>,
procedure_id: ProcedureId,
Expand Down
2 changes: 1 addition & 1 deletion src/datanode/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub enum Error {
))]
ColumnValuesNumberMismatch { columns: usize, values: usize },

#[snafu(display("Missing insert body, source: "))]
#[snafu(display("Missing insert body"))]
MissingInsertBody {
source: sql::error::Error,
location: Location,
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 @@ -154,7 +154,7 @@ pub enum Error {
source: query::error::Error,
},

#[snafu(display("Failed to read table: {table_name}, source: "))]
#[snafu(display("Failed to read table: {table_name}"))]
ReadTable {
table_name: String,
#[snafu(backtrace)]
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 @@ -360,19 +360,19 @@ pub enum Error {
#[snafu(display("Missing required parameter, param: {:?}", param))]
MissingRequiredParameter { param: String },

#[snafu(display("Failed to recover procedure, source: "))]
#[snafu(display("Failed to recover procedure"))]
RecoverProcedure {
location: Location,
source: common_procedure::Error,
},

#[snafu(display("Failed to wait procedure done, source: "))]
#[snafu(display("Failed to wait procedure done"))]
WaitProcedure {
location: Location,
source: common_procedure::Error,
},

#[snafu(display("Failed to submit procedure, source: "))]
#[snafu(display("Failed to submit procedure"))]
SubmitProcedure {
location: Location,
source: common_procedure::Error,
Expand Down
9 changes: 2 additions & 7 deletions src/mito2/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,7 @@ pub enum Error {
location: Location,
},

#[snafu(display(
"Failed to compact region {}, location: {}, source:{}",
region_id,
location,
source
))]
#[snafu(display("Failed to compact region {}, location: {}", region_id, location))]
CompactRegion {
region_id: RegionId,
source: Arc<Error>,
Expand All @@ -381,7 +376,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("{}, location: {}", source, location))]
#[snafu(display("Invalue region req"))]
InvalidRegionRequest {
source: store_api::metadata::MetadataError,
location: Location,
Expand Down
3 changes: 1 addition & 2 deletions src/promql/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ pub enum Error {
},

#[snafu(display(
"Internal error during building DataFusion plan, error: {}, location: {}",
source,
"Internal error during building DataFusion plan, location: {}",
location
))]
DataFusionPlanning {
Expand Down
12 changes: 6 additions & 6 deletions src/servers/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,20 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to build HTTP response, source: "))]
#[snafu(display("Failed to build HTTP response"))]
BuildHttpResponse {
source: http::Error,
location: Location,
},

#[snafu(display("Failed to parse PromQL: {query:?}, source: "))]
#[snafu(display("Failed to parse PromQL: {query:?}"))]
ParsePromQL {
query: PromQuery,
location: Location,
source: query::error::Error,
},

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

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

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

#[snafu(display("Failed to convert scalar value, source: , location: {location}"))]
#[snafu(display("Failed to convert scalar value, location: {location}"))]
ConvertScalarValue {
source: datatypes::error::Error,
location: Location,
Expand Down
8 changes: 4 additions & 4 deletions src/servers/src/http/pprof/nix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ use snafu::{Location, ResultExt, Snafu};

#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("Failed to create profiler guard, location: {}", source, location))]
#[snafu(display("Failed to create profiler guard, location: {}", location))]
CreateGuard {
source: pprof::Error,
location: Location,
},

#[snafu(display("Failed to create report, location: {}", source, location))]
#[snafu(display("Failed to create report, location: {}", location))]
CreateReport {
source: pprof::Error,
location: Location,
},

#[snafu(display("Failed to create flamegraph, location: {}", source, location))]
#[snafu(display("Failed to create flamegraph, location: {}", location))]
CreateFlamegraph {
source: pprof::Error,
location: Location,
},

#[snafu(display("Failed to create pprof report, location: {}", source, location))]
#[snafu(display("Failed to create pprof report, location: {}", location))]
ReportPprof {
source: pprof::Error,
location: Location,
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, source: , location: {location}"))]
#[snafu(display("Failed to update jemalloc metrics, location: {location}"))]
UpdateJemallocMetrics {
source: tikv_jemalloc_ctl::Error,
location: Location,
Expand Down
4 changes: 2 additions & 2 deletions src/storage/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ pub enum Error {
source: BoxedError,
},

#[snafu(display("Failed to encode WAL header, source"))]
#[snafu(display("Failed to encode WAL header"))]
EncodeWalHeader {
location: Location,
source: std::io::Error,
},

#[snafu(display("Failed to decode WAL header, source"))]
#[snafu(display("Failed to decode WAL header"))]
DecodeWalHeader {
location: Location,
source: std::io::Error,
Expand Down
2 changes: 1 addition & 1 deletion src/store-api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub enum Error {
#[snafu(display("Invalid raw region request: {err}, at {location}"))]
InvalidRawRegionRequest { err: String, location: Location },

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

0 comments on commit 76e1a86

Please sign in to comment.