refactor: remove source and location in snafu display (#2428)

* refactor: remove source pt 1

* refactor: remove source pt 2

* refactor: remove source pt 3

* refactor: remove location pt 1

* refactor: remove location pt 2

* chore: remove rustc files

* chore: fix error case

* chore: fix test

* chore: fix test

* chore: fix cr issue

Co-authored-by: fys <40801205+fengys1996@users.noreply.github.com>

---------

Co-authored-by: fys <40801205+fengys1996@users.noreply.github.com>
This commit is contained in:
shuiyisong
2023-09-21 02:55:24 +00:00
committed by GitHub
co-authored by fys
parent 9863e501f1
commit 20f4f7971a
51 changed files with 680 additions and 1031 deletions
+6 -10
View File
@@ -27,25 +27,21 @@ pub enum Error {
#[snafu(display("Scripts table not found"))]
ScriptsTableNotFound { location: Location },
#[snafu(display(
"Failed to insert script to scripts table, name: {}, source: {}",
name,
source
))]
#[snafu(display("Failed to insert script to scripts table, name: {}", name))]
InsertScript {
name: String,
location: Location,
source: BoxedError,
},
#[snafu(display("Failed to compile python script, name: {}, source: {}", name, source))]
#[snafu(display("Failed to compile python script, name: {}", name))]
CompilePython {
name: String,
location: Location,
source: crate::python::error::Error,
},
#[snafu(display("Failed to execute python script {}, source: {}", name, source))]
#[snafu(display("Failed to execute python script {}", name))]
ExecutePython {
name: String,
location: Location,
@@ -55,7 +51,7 @@ pub enum Error {
#[snafu(display("Script not found, name: {}", name))]
ScriptNotFound { location: Location, name: String },
#[snafu(display("Failed to collect record batch, source: {}", source))]
#[snafu(display("Failed to collect record batch"))]
CollectRecords {
location: Location,
source: common_recordbatch::error::Error,
@@ -64,13 +60,13 @@ pub enum Error {
#[snafu(display("Failed to cast type, msg: {}", msg))]
CastType { msg: String, location: Location },
#[snafu(display("Failed to build DataFusion logical plan, source: {}", source))]
#[snafu(display("Failed to build DataFusion logical plan"))]
BuildDfLogicalPlan {
source: datafusion_common::DataFusionError,
location: Location,
},
#[snafu(display("Failed to execute internal statement, source: {}", source))]
#[snafu(display("Failed to execute internal statement"))]
ExecuteInternalStatement {
source: query::error::Error,
location: Location,
+9 -9
View File
@@ -34,25 +34,25 @@ pub(crate) fn ret_other_error_with(reason: String) -> OtherSnafu<String> {
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
#[snafu(display("Datatype error: {}", source))]
#[snafu(display("Datatype error"))]
TypeCast {
location: SnafuLocation,
source: DataTypeError,
},
#[snafu(display("Failed to query, source: {}", source))]
#[snafu(display("Failed to query"))]
DatabaseQuery {
location: SnafuLocation,
source: QueryError,
},
#[snafu(display("Failed to parse script, source: {}", source))]
#[snafu(display("Failed to parse script"))]
PyParse {
location: SnafuLocation,
source: ParseError,
},
#[snafu(display("Failed to compile script, source: {}", source))]
#[snafu(display("Failed to compile script"))]
PyCompile {
location: SnafuLocation,
source: CodegenError,
@@ -65,13 +65,13 @@ pub enum Error {
location: SnafuLocation,
},
#[snafu(display("Arrow error: {}", source))]
#[snafu(display("Arrow error"))]
Arrow {
location: SnafuLocation,
source: ArrowError,
},
#[snafu(display("DataFusion error: {}", source))]
#[snafu(display("DataFusion error"))]
DataFusion {
location: SnafuLocation,
source: DataFusionError,
@@ -104,18 +104,18 @@ pub enum Error {
location: SnafuLocation,
},
#[snafu(display("Failed to retrieve record batches, source: {}", source))]
#[snafu(display("Failed to retrieve record batches"))]
RecordBatch {
location: SnafuLocation,
source: common_recordbatch::error::Error,
},
#[snafu(display("Failed to create record batch, source: {}", source))]
#[snafu(display("Failed to create record batch"))]
NewRecordBatch {
location: SnafuLocation,
source: common_recordbatch::error::Error,
},
#[snafu(display("Failed to create tokio task, source: {}", source))]
#[snafu(display("Failed to create tokio task"))]
TokioJoin { source: tokio::task::JoinError },
}