Struct Error
pub struct Error {
pub kind: ErrorKind,
pub location: &'static Location<'static>,
}Expand description
Error type used extnesively by this crate.
It can represent two types of errors, “critical” and “soft” errors. With “critical” errors Kanzi is left in undefined state and the exectuion might trigger unexpected behavior; while “soft” errors are produced by this library without calling into Kanzi, so those might be handled and the execution can continue.
All errors are adorned with Location. This gives limited context, which might be helpful
during debugging.
Fields§
§kind: ErrorKind§location: &'static Location<'static>Implementations§
§impl Error
impl Error
pub fn critical_error(context: &str) -> Error
pub fn critical_error(context: &str) -> Error
Critical exception from Kanzi. Getting this implies that Kanzi is left in inconsistent state and further usage of API might not be safe.
let error = Error::critical_error("Failed to locate '#DATA: Node2D' in a screen tree");
assert_eq!(
error.to_string(),
r#"
CriticalError (Unknown): Failed to locate '#DATA: Node2D' in a screen tree
at 'crates\kzbridge\src\exceptions.rs':7:13
"#.trim(),
);pub const fn stale_object() -> Error
pub const fn invalid_argument() -> Error
pub const fn object_not_found() -> Error
pub const fn index_out_of_bounds() -> Error
pub const fn is_critical_error(&self) -> bool
pub const fn is_soft_error(&self) -> bool
pub const fn is_soft_error(&self) -> bool
Execution can safely continue when soft error (any error except for Self::CriticalError)
is returned.
pub const fn is_stale_object(&self) -> bool
pub const fn is_invalid_argument(&self) -> bool
pub const fn is_object_not_found(&self) -> bool
pub const fn is_index_out_of_bounds(&self) -> bool
pub const fn is_type_mismatch(&self) -> bool
pub const fn as_sys_kind(&self) -> ExecutionStatusKind
pub fn get_last_error() -> Option<Error>
Trait Implementations§
§impl Error for Error
impl Error for Error
1.30.0 · 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()
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