Skip to content

Commit

Permalink
build(deps): bump snafu to 0.8 (GreptimeTeam#3911)
Browse files Browse the repository at this point in the history
* change Cargo.toml

Signed-off-by: Ruihang Xia <[email protected]>

* global replace

Signed-off-by: Ruihang Xia <[email protected]>

* handle alias in script engine

Signed-off-by: Ruihang Xia <[email protected]>

* fix clippy

Signed-off-by: Ruihang Xia <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored May 10, 2024
1 parent aec5cca commit 115c747
Show file tree
Hide file tree
Showing 51 changed files with 2,211 additions and 348 deletions.
127 changes: 74 additions & 53 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["float_roundtrip"] }
serde_with = "3"
smallvec = { version = "1", features = ["serde"] }
snafu = "0.7"
snafu = "0.8"
sysinfo = "0.30"
# on branch v0.44.x
sqlparser = { git = "https://github.com/GreptimeTeam/sqlparser-rs.git", rev = "c919990bf62ad38d2b0c0a3bc90b26ad919d51b0", features = [
Expand Down
4 changes: 4 additions & 0 deletions src/api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum Error {
#[snafu(display("Unknown proto column datatype: {}", datatype))]
UnknownColumnDataType {
datatype: i32,
#[snafu(implicit)]
location: Location,
#[snafu(source)]
error: prost::DecodeError,
Expand All @@ -38,19 +39,22 @@ pub enum Error {
#[snafu(display("Failed to create column datatype from {:?}", from))]
IntoColumnDataType {
from: ConcreteDataType,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Failed to convert column default constraint, column: {}", column))]
ConvertColumnDefaultConstraint {
column: String,
#[snafu(implicit)]
location: Location,
source: datatypes::error::Error,
},

#[snafu(display("Invalid column default constraint, column: {}", column))]
InvalidColumnDefaultConstraint {
column: String,
#[snafu(implicit)]
location: Location,
source: datatypes::error::Error,
},
Expand Down
7 changes: 6 additions & 1 deletion src/auth/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ pub enum Error {
Io {
#[snafu(source)]
error: std::io::Error,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Auth failed"))]
AuthBackend {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
Expand Down Expand Up @@ -72,7 +74,10 @@ pub enum Error {
},

#[snafu(display("User is not authorized to perform this action"))]
PermissionDenied { location: Location },
PermissionDenied {
#[snafu(implicit)]
location: Location,
},
}

impl ErrorExt for Error {
Expand Down
82 changes: 73 additions & 9 deletions src/catalog/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ use tokio::task::JoinError;
pub enum Error {
#[snafu(display("Failed to list catalogs"))]
ListCatalogs {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},

#[snafu(display("Failed to list {}'s schemas", catalog))]
ListSchemas {
#[snafu(implicit)]
location: Location,
catalog: String,
source: BoxedError,
},

#[snafu(display("Failed to list {}.{}'s tables", catalog, schema))]
ListTables {
#[snafu(implicit)]
location: Location,
catalog: String,
schema: String,
Expand All @@ -51,109 +54,146 @@ pub enum Error {

#[snafu(display("Failed to list nodes in cluster: {source}"))]
ListNodes {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},

#[snafu(display("Failed to re-compile script due to internal error"))]
CompileScriptInternal {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},
#[snafu(display("Failed to open system catalog table"))]
OpenSystemCatalog {
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("Failed to create system catalog table"))]
CreateSystemCatalog {
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("Failed to create table, table info: {}", table_info))]
CreateTable {
table_info: String,
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("System catalog is not valid: {}", msg))]
SystemCatalog { msg: String, location: Location },
SystemCatalog {
msg: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display(
"System catalog table type mismatch, expected: binary, found: {:?}",
data_type,
))]
SystemCatalogTypeMismatch {
data_type: ConcreteDataType,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Invalid system catalog entry type: {:?}", entry_type))]
InvalidEntryType {
entry_type: Option<u8>,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Invalid system catalog key: {:?}", key))]
InvalidKey {
key: Option<String>,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Catalog value is not present"))]
EmptyValue { location: Location },
EmptyValue {
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Failed to deserialize value"))]
ValueDeserialize {
#[snafu(source)]
error: serde_json::error::Error,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Table engine not found: {}", engine_name))]
TableEngineNotFound {
engine_name: String,
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("Cannot find catalog by name: {}", catalog_name))]
CatalogNotFound {
catalog_name: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Cannot find schema {} in catalog {}", schema, catalog))]
SchemaNotFound {
catalog: String,
schema: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Table `{}` already exists", table))]
TableExists { table: String, location: Location },
TableExists {
table: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Table not found: {}", table))]
TableNotExist { table: String, location: Location },
TableNotExist {
table: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Schema {} already exists", schema))]
SchemaExists { schema: String, location: Location },
SchemaExists {
schema: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Operation {} not implemented yet", operation))]
Unimplemented {
operation: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Operation {} not supported", op))]
NotSupported { op: String, location: Location },
NotSupported {
op: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Failed to open table {table_id}"))]
OpenTable {
table_id: TableId,
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},
Expand All @@ -167,6 +207,7 @@ pub enum Error {
#[snafu(display("Table not found while opening table, table info: {}", table_info))]
TableNotFound {
table_info: String,
#[snafu(implicit)]
location: Location,
},

Expand All @@ -178,57 +219,69 @@ pub enum Error {

#[snafu(display("Failed to read system catalog table records"))]
ReadSystemCatalog {
#[snafu(implicit)]
location: Location,
source: common_recordbatch::error::Error,
},

#[snafu(display("Failed to create recordbatch"))]
CreateRecordBatch {
#[snafu(implicit)]
location: Location,
source: common_recordbatch::error::Error,
},

#[snafu(display("Failed to insert table creation record to system catalog"))]
InsertCatalogRecord {
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("Failed to scan system catalog table"))]
SystemCatalogTableScan {
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("Internal error"))]
Internal {
#[snafu(implicit)]
location: Location,
source: BoxedError,
},

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

#[snafu(display("Failed to execute system catalog table scan"))]
SystemCatalogTableScanExec {
#[snafu(implicit)]
location: Location,
source: common_query::error::Error,
},

#[snafu(display("Cannot parse catalog value"))]
InvalidCatalogValue {
#[snafu(implicit)]
location: Location,
source: common_catalog::error::Error,
},

#[snafu(display("Failed to perform metasrv operation"))]
Metasrv {
#[snafu(implicit)]
location: Location,
source: meta_client::error::Error,
},

#[snafu(display("Invalid table info in catalog"))]
InvalidTableInfoInCatalog {
#[snafu(implicit)]
location: Location,
source: datatypes::error::Error,
},
Expand All @@ -240,26 +293,37 @@ pub enum Error {
Datafusion {
#[snafu(source)]
error: DataFusionError,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Table schema mismatch"))]
TableSchemaMismatch {
#[snafu(implicit)]
location: Location,
source: table::error::Error,
},

#[snafu(display("A generic error has occurred, msg: {}", msg))]
Generic { msg: String, location: Location },
Generic {
msg: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Table metadata manager error"))]
TableMetadataManager {
source: common_meta::error::Error,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Get null from table cache, key: {}", key))]
TableCacheNotGet { key: String, location: Location },
TableCacheNotGet {
key: String,
#[snafu(implicit)]
location: Location,
},

#[snafu(display("Failed to get table cache, err: {}", err_msg))]
GetTableCache { err_msg: String },
Expand Down
Loading

0 comments on commit 115c747

Please sign in to comment.