From ed81732df1fa432c41c3732ae3915a28bdcd92c9 Mon Sep 17 00:00:00 2001 From: Olivier Date: Sun, 5 Jan 2025 20:37:42 +0100 Subject: [PATCH] move errors.rs file to reachable place for workspaces --- opcua-core/src/lib.rs | 1 - opcua-types/Cargo.toml | 1 - {opcua-core => opcua-types}/src/errors.rs | 8 ++++++-- opcua-types/src/lib.rs | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) rename {opcua-core => opcua-types}/src/errors.rs (71%) diff --git a/opcua-core/src/lib.rs b/opcua-core/src/lib.rs index a4b28a320..14f8ad6e8 100644 --- a/opcua-core/src/lib.rs +++ b/opcua-core/src/lib.rs @@ -64,7 +64,6 @@ pub mod constants { pub mod comms; pub mod config; -pub mod errors; pub mod handle; pub mod messages; diff --git a/opcua-types/Cargo.toml b/opcua-types/Cargo.toml index ce2120275..c654fbe61 100644 --- a/opcua-types/Cargo.toml +++ b/opcua-types/Cargo.toml @@ -35,7 +35,6 @@ struson = { workspace = true, optional = true } opcua-xml = { path = "../opcua-xml", optional = true } - [dev-dependencies] opcua-types = { path = ".", features = ["xml", "json"] } serde_json = { workspace = true } diff --git a/opcua-core/src/errors.rs b/opcua-types/src/errors.rs similarity index 71% rename from opcua-core/src/errors.rs rename to opcua-types/src/errors.rs index 6c9a854c3..8f4c05f82 100644 --- a/opcua-core/src/errors.rs +++ b/opcua-types/src/errors.rs @@ -3,15 +3,19 @@ //! Rust OpcUa specific errors -use opcua_types::VariantScalarTypeId; use thiserror::Error; +use crate::VariantScalarTypeId; + /// Rust OpcUa specific errors #[allow(missing_docs)] #[derive(Error, Debug)] pub enum OpcUAError { #[error("Received an unexpected variant type")] - UnexpectedVariantType(Option), + UnexpectedVariantType { + variant_id: Option, + message: String, + }, #[error("The requested namespace does not exists")] NamespaceDoesNotExist(String), } diff --git a/opcua-types/src/lib.rs b/opcua-types/src/lib.rs index 5beb7ebe5..f06fec037 100644 --- a/opcua-types/src/lib.rs +++ b/opcua-types/src/lib.rs @@ -250,6 +250,7 @@ pub mod data_value; pub mod date_time; pub mod diagnostic_info; pub mod encoding; +pub mod errors; pub mod event_field; pub mod expanded_node_id; pub mod extension_object;