pub enum NeoError {
InvalidOperation,
InvalidArgument,
InvalidType,
OutOfBounds,
DivisionByZero,
Overflow,
Underflow,
NullReference,
InvalidState,
Custom(String),
}Expand description
Neo N3 Error type
Represents all possible error conditions that can occur during Neo N3 smart contract execution.
Variants§
InvalidOperation
Operation is not valid in the current context
InvalidArgument
Argument has an invalid value or type
InvalidType
Type mismatch encountered during execution
OutOfBounds
Index or offset is out of valid bounds
DivisionByZero
Attempted division by zero
Overflow
Arithmetic overflow occurred
Underflow
Arithmetic underflow occurred
NullReference
Dereferenced a null or invalid reference
InvalidState
Internal state is invalid or corrupted
Custom(String)
Application-specific error with custom message
Implementations§
Source§impl NeoError
impl NeoError
Sourcepub fn new(message: &str) -> Self
pub fn new(message: &str) -> Self
Creates a new custom error with the given message.
§Examples
use neo_types::NeoError;
let err = NeoError::new("Custom error message");Sourcepub fn status_code(&self) -> i64
pub fn status_code(&self) -> i64
Returns a stable status code for this error variant.
These codes are used by generated export wrappers to avoid silently
treating failures as successful 0 values.
Trait Implementations§
impl Eq for NeoError
Source§impl Error for NeoError
impl Error for NeoError
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()
impl StructuralPartialEq for NeoError
Auto Trait Implementations§
impl Freeze for NeoError
impl RefUnwindSafe for NeoError
impl Send for NeoError
impl Sync for NeoError
impl Unpin for NeoError
impl UnsafeUnpin for NeoError
impl UnwindSafe for NeoError
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