diff --git a/Cargo.lock b/Cargo.lock index 065078e7f7768..065fcf731f73e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -186,7 +186,7 @@ dependencies = [ "serde", "serde_json", "snap", - "strum", + "strum 0.25.0", "strum_macros 0.25.3", "thiserror", "typed-builder 0.16.2", @@ -211,7 +211,7 @@ dependencies = [ "regex-lite", "serde", "serde_json", - "strum", + "strum 0.25.0", "strum_macros 0.25.3", "thiserror", "typed-builder 0.18.0", @@ -2206,7 +2206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" dependencies = [ "crossterm 0.27.0", - "strum", + "strum 0.25.0", "strum_macros 0.25.3", "unicode-width", ] @@ -3051,7 +3051,7 @@ dependencies = [ "arrow-array 48.0.1", "datafusion-common", "sqlparser", - "strum", + "strum 0.25.0", "strum_macros 0.25.3", ] @@ -8831,7 +8831,7 @@ dependencies = [ "risingwave_meta_node", "risingwave_rt", "shell-words", - "strum", + "strum 0.25.0", "strum_macros 0.26.1", "task_stats_alloc", "tempfile", @@ -8931,7 +8931,7 @@ dependencies = [ "smallbitset", "speedate", "static_assertions", - "strum", + "strum 0.26.1", "strum_macros 0.26.1", "sysinfo", "tempfile", @@ -9178,7 +9178,7 @@ dependencies = [ "serde_with", "serde_yaml", "simd-json", - "strum", + "strum 0.26.1", "strum_macros 0.26.1", "syn 1.0.109", "tempfile", @@ -9668,7 +9668,7 @@ dependencies = [ "sea-orm", "serde", "serde_json", - "strum", + "strum 0.25.0", "sync-point", "thiserror", "thiserror-ext", @@ -9811,7 +9811,7 @@ dependencies = [ "prost-helpers", "risingwave_error", "serde", - "strum", + "strum 0.25.0", "thiserror", "walkdir", "workspace-hack", @@ -10161,6 +10161,8 @@ dependencies = [ "serde_yaml", "smallvec", "static_assertions", + "strum 0.26.1", + "strum_macros 0.26.1", "task_stats_alloc", "thiserror", "thiserror-ext", @@ -10649,7 +10651,7 @@ dependencies = [ "serde", "serde_json", "sqlx", - "strum", + "strum 0.25.0", "thiserror", "time", "tracing", @@ -11374,7 +11376,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "242f76c50fd18cbf098607090ade73a08d39cfd84ea835f3796a2c855223b19b" dependencies = [ - "strum", + "strum 0.25.0", "strum_macros 0.25.3", ] @@ -11776,6 +11778,12 @@ dependencies = [ "strum_macros 0.25.3", ] +[[package]] +name = "strum" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" + [[package]] name = "strum_macros" version = "0.25.3" @@ -14091,7 +14099,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "strum", + "strum 0.25.0", "subtle", "syn 1.0.109", "syn 2.0.48", diff --git a/src/common/Cargo.toml b/src/common/Cargo.toml index 61bca47e1018f..5fd7a74753030 100644 --- a/src/common/Cargo.toml +++ b/src/common/Cargo.toml @@ -93,7 +93,7 @@ serde_with = "3" smallbitset = "0.7.1" speedate = "0.13.0" static_assertions = "1" -strum = "0.25" +strum = "0.26" strum_macros = "0.26" sysinfo = { version = "0.30", default-features = false } thiserror = "1" diff --git a/src/connector/Cargo.toml b/src/connector/Cargo.toml index 1efdce6a2d875..77f2c1374dc92 100644 --- a/src/connector/Cargo.toml +++ b/src/connector/Cargo.toml @@ -106,7 +106,11 @@ rdkafka = { workspace = true, features = [ "gssapi", "zstd", ] } -redis = { version = "0.24.0", features = ["aio","tokio-comp","async-std-comp"] } +redis = { version = "0.24.0", features = [ + "aio", + "tokio-comp", + "async-std-comp", +] } regex = "1.4" reqwest = { version = "0.11", features = ["json"] } risingwave_common = { workspace = true } @@ -120,7 +124,7 @@ serde_derive = "1" serde_json = "1" serde_with = { version = "3", features = ["json"] } simd-json = "0.13.3" -strum = "0.25" +strum = "0.26" strum_macros = "0.26" tempfile = "3" thiserror = "1" diff --git a/src/stream/Cargo.toml b/src/stream/Cargo.toml index 389b88aed043a..e69cf5a76180d 100644 --- a/src/stream/Cargo.toml +++ b/src/stream/Cargo.toml @@ -59,6 +59,8 @@ rw_futures_util = { workspace = true } serde_json = "1" smallvec = "1" static_assertions = "1" +strum = "0.26" +strum_macros = "0.26" thiserror = "1" thiserror-ext = { workspace = true } tokio = { version = "0.2", package = "madsim-tokio", features = [ diff --git a/src/stream/src/executor/error.rs b/src/stream/src/executor/error.rs index ccfe52cd1e66c..558c0c7088d9b 100644 --- a/src/stream/src/executor/error.rs +++ b/src/stream/src/executor/error.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::convert::AsRef; + use risingwave_common::array::ArrayError; use risingwave_common::error::{BoxedError, NotImplemented}; use risingwave_common::util::value_encoding::error::ValueEncodingError; @@ -22,6 +24,7 @@ use risingwave_expr::ExprError; use risingwave_pb::PbFieldNotFound; use risingwave_rpc_client::error::RpcError; use risingwave_storage::error::StorageError; +use strum_macros::AsRefStr; use super::Barrier; @@ -31,6 +34,7 @@ pub type StreamExecutorResult = std::result::Result; /// The error type for streaming executors. #[derive(thiserror::Error, Debug, thiserror_ext::Box, thiserror_ext::Construct)] #[thiserror_ext(newtype(name = StreamExecutorError, backtrace, report_debug))] +#[derive(AsRefStr)] pub enum ErrorKind { #[error("Storage error: {0}")] Storage( @@ -141,21 +145,8 @@ impl From for StreamExecutorError { } impl StreamExecutorError { - pub fn variant_name(&self) -> &'static str { - match self.0.inner() { - ErrorKind::Storage(_) => "StorageError", - ErrorKind::ArrayError(_) => "ArrayError", - ErrorKind::ExprError(_) => "ExprError", - ErrorKind::SerdeError(_) => "SerdeError", - ErrorKind::SinkError(_) => "SinkError", - ErrorKind::RpcError(_) => "RpcError", - ErrorKind::ChannelClosed(_) => "ChannelClosed", - ErrorKind::AlignBarrier(_, _) => "AlignBarrier", - ErrorKind::ConnectorError(_) => "ConnectorError", - ErrorKind::DmlError(_) => "DmlError", - ErrorKind::NotImplemented(_) => "NotImplemented", - ErrorKind::Internal(_) => "Internal", - } + pub fn variant_name(&self) -> &str { + self.0.inner().as_ref() } }