pub struct Error { /* private fields */ }Expand description
General OPC-UA error.
Contains context about the request this error occured as part of, if that is possible to retrieve, as well as details about the error that caused this, and a status code.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(
status: StatusCode,
context: impl Into<Box<dyn StdError + Send + Sync>>,
) -> Self
pub fn new( status: StatusCode, context: impl Into<Box<dyn StdError + Send + Sync>>, ) -> Self
Create a new error with the specified status code and
context as a dynamic error source.
Sourcepub fn decoding(context: impl Into<Box<dyn StdError + Send + Sync>>) -> Self
pub fn decoding(context: impl Into<Box<dyn StdError + Send + Sync>>) -> Self
Create a new error with status code BadDecodingError and
context as a dynamic error source.
Sourcepub fn encoding(context: impl Into<Box<dyn StdError + Send + Sync>>) -> Self
pub fn encoding(context: impl Into<Box<dyn StdError + Send + Sync>>) -> Self
Create a new error with status code BadEncodingError and
context as a dynamic error source.
Sourcepub fn with_context(
self,
request_id: Option<u32>,
request_handle: Option<u32>,
) -> Self
pub fn with_context( self, request_id: Option<u32>, request_handle: Option<u32>, ) -> Self
Add request ID and request handle to this error.
Sourcepub fn with_request_id(self, id: u32) -> Self
pub fn with_request_id(self, id: u32) -> Self
Add request ID to this error.
Sourcepub fn with_request_handle(self, handle: u32) -> Self
pub fn with_request_handle(self, handle: u32) -> Self
Add request handle to this error.
Sourcepub fn maybe_with_request_handle(self, handle: Option<u32>) -> Self
pub fn maybe_with_request_handle(self, handle: Option<u32>) -> Self
Utility for setting request handle when it is maybe initialized.
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Get the inner status code of this error.
Sourcepub fn full_context(&self) -> Option<(u32, u32)>
pub fn full_context(&self) -> Option<(u32, u32)>
Get the full context of this error, if both fields are present.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()