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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for OpcUaError
impl From<Error> for OpcUaError
Source§impl From<Error> for StatusCode
impl From<Error> for StatusCode
Source§impl From<JsonNumberError> for Error
impl From<JsonNumberError> for Error
Source§fn from(value: JsonNumberError) -> Self
fn from(value: JsonNumberError) -> Self
Converts to this type from the input type.
Source§impl From<ParseFloatError> for Error
impl From<ParseFloatError> for Error
Source§fn from(value: ParseFloatError) -> Self
fn from(value: ParseFloatError) -> Self
Converts to this type from the input type.
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(value: ParseIntError) -> Self
fn from(value: ParseIntError) -> Self
Converts to this type from the input type.
Source§impl From<ReaderError> for Error
impl From<ReaderError> for Error
Source§fn from(value: ReaderError) -> Self
fn from(value: ReaderError) -> Self
Converts to this type from the input type.
Source§impl From<TransferError> for Error
impl From<TransferError> for Error
Source§fn from(value: TransferError) -> Self
fn from(value: TransferError) -> Self
Converts to this type from the input type.
Source§impl From<UninitializedIndex> for Error
impl From<UninitializedIndex> for Error
Source§fn from(value: UninitializedIndex) -> Self
fn from(value: UninitializedIndex) -> Self
Converts to this type from the input type.
Source§impl From<XmlReadError> for Error
impl From<XmlReadError> for Error
Source§fn from(value: XmlReadError) -> Self
fn from(value: XmlReadError) -> Self
Converts to this type from the input type.
Source§impl From<XmlWriteError> for Error
impl From<XmlWriteError> for Error
Source§fn from(value: XmlWriteError) -> Self
fn from(value: XmlWriteError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more