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 Error + Sync + Send>>,
) -> Error
pub fn new( status: StatusCode, context: impl Into<Box<dyn Error + Sync + Send>>, ) -> Error
Create a new error with the specified status code and
context as a dynamic error source.
Sourcepub fn decoding(context: impl Into<Box<dyn Error + Sync + Send>>) -> Error
pub fn decoding(context: impl Into<Box<dyn Error + Sync + Send>>) -> Error
Create a new error with status code BadDecodingError and
context as a dynamic error source.
Sourcepub fn encoding(context: impl Into<Box<dyn Error + Sync + Send>>) -> Error
pub fn encoding(context: impl Into<Box<dyn Error + Sync + Send>>) -> Error
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>,
) -> Error
pub fn with_context( self, request_id: Option<u32>, request_handle: Option<u32>, ) -> Error
Add request ID and request handle to this error.
Sourcepub fn with_request_id(self, id: u32) -> Error
pub fn with_request_id(self, id: u32) -> Error
Add request ID to this error.
Sourcepub fn with_request_handle(self, handle: u32) -> Error
pub fn with_request_handle(self, handle: u32) -> Error
Add request handle to this error.
Sourcepub fn maybe_with_request_handle(self, handle: Option<u32>) -> Error
pub fn maybe_with_request_handle(self, handle: Option<u32>) -> Error
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 Error + 'static)>
fn source(&self) -> Option<&(dyn Error + '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§fn from(value: Error) -> OpcUaError
fn from(value: Error) -> OpcUaError
Converts to this type from the input type.
Source§impl From<Error> for StatusCode
impl From<Error> for StatusCode
Source§fn from(value: Error) -> StatusCode
fn from(value: Error) -> StatusCode
Converts to this type from the input type.
Source§impl From<JsonNumberError> for Error
impl From<JsonNumberError> for Error
Source§fn from(value: JsonNumberError) -> Error
fn from(value: JsonNumberError) -> Error
Converts to this type from the input type.
Source§impl From<ParseFloatError> for Error
impl From<ParseFloatError> for Error
Source§fn from(value: ParseFloatError) -> Error
fn from(value: ParseFloatError) -> Error
Converts to this type from the input type.
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(value: ParseIntError) -> Error
fn from(value: ParseIntError) -> Error
Converts to this type from the input type.
Source§impl From<ReaderError> for Error
impl From<ReaderError> for Error
Source§fn from(value: ReaderError) -> Error
fn from(value: ReaderError) -> Error
Converts to this type from the input type.
Source§impl From<TransferError> for Error
impl From<TransferError> for Error
Source§fn from(value: TransferError) -> Error
fn from(value: TransferError) -> Error
Converts to this type from the input type.
Source§impl From<UninitializedIndex> for Error
impl From<UninitializedIndex> for Error
Source§fn from(value: UninitializedIndex) -> Error
fn from(value: UninitializedIndex) -> Error
Converts to this type from the input type.
Source§impl From<XmlReadError> for Error
impl From<XmlReadError> for Error
Source§fn from(value: XmlReadError) -> Error
fn from(value: XmlReadError) -> Error
Converts to this type from the input type.
Source§impl From<XmlWriteError> for Error
impl From<XmlWriteError> for Error
Source§fn from(value: XmlWriteError) -> Error
fn from(value: XmlWriteError) -> Error
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 UnsafeUnpin 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