#[non_exhaustive]#[repr(i32)]pub enum ErrorReason {
Unknown = 0,
FieldInvalid = 1,
FieldMissing = 2,
InsufficientGasBalance = 3,
TransactionExecutionFailed = 4,
}Expand description
Error reasons in the sui.io error domain, used as the reason of a
google.rpc.ErrorInfo or of a google.rpc.BadRequest.FieldViolation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unknown = 0
FieldInvalid = 1
FieldMissing = 2
InsufficientGasBalance = 3
Gas selection could not find enough SUI to cover the gas budget.
SimulateTransaction returns this with INVALID_ARGUMENT. Gas selection
runs only when do_gas_selection is set, checks is not DISABLED, and
the transaction has no gas payment objects. When the server estimates the
budget and the transaction fails in that estimation, SimulateTransaction
returns TRANSACTION_EXECUTION_FAILED instead of this error, so with an
estimated budget this reason means the transaction executed successfully
in simulation.
Example of an ErrorInfo when the gas owner holds a single 2246360 MIST coin, has no address balance, and the transaction needs a budget of 8924024 MIST:
{ "reason": "INSUFFICIENT_GAS_BALANCE",
"domain": "sui.io",
"metadata": {
"owner": "0x0000000000000000000000000000000000000000000000000000000000000123",
"requiredBudget": "8924024",
"coinBalance": "2246360",
"addressBalance": "0"
}
}Metadata, with amounts in MIST as decimal strings:
owner: the gas owner’s address, as “0x” followed by 64 hex digits.requiredBudget: the gas budget the transaction needs. When the request leaves the budget unset, this is the server’s estimate plus the cost of loading every coin counted incoinBalancebeyond the first; otherwise it is the budget from the request. An estimatedrequiredBudgetdepends on how many coins the gas owner holds: when the owner already holds coins, sending it a new coin raisesrequiredBudgetby up to the cost of loading one more coin. A new coin worthrequiredBudgetcovers that increase unlesscoinBalanceis less than the cost of loading one coin; a new coin worth onlyrequiredBudgetminuscoinBalancecan fall short.coinBalance: total of the gas owner’sCoin<SUI>objects considered by gas selection: owned, non-consensus coins not already used as transaction inputs, largest first, up to the protocol’s maximum number of gas payment objects.addressBalance: the gas owner’s SUI address balance remaining after the transaction’s own explicit SUI withdrawals from the gas owner; “0” if there is none.
The two balances are reported separately because they combine
differently. When the transaction uses the gas coin (an Argument of kind
GAS), coins and address balance are combined to pay for gas. Otherwise
they are never combined: the address balance pays for gas only if it
alone covers the budget before coin-loading costs, which is at most
requiredBudget; if it does not, the coins alone must cover
requiredBudget.
TransactionExecutionFailed = 4
The transaction failed while executing in simulation. SimulateTransaction
returns this with INVALID_ARGUMENT when it estimates the budget, the
transaction fails in that estimation, and gas selection then cannot cover
the budget. It is returned instead of the INSUFFICIENT_GAS_BALANCE
reason in that case because the transaction fails even with its gas paid
for, so the gas budget is not what stops it; kind says what does. Some
kinds can still be fixed by adding funds: for example,
INSUFFICIENT_FUNDS_FOR_WITHDRAW means a balance the transaction
withdraws from holds too little. INSUFFICIENT_GAS cannot: the estimation
runs with the maximum gas budget, so it means the transaction needs more
gas than any budget allows. A gas owner that can cover the budget instead
gets a successful response whose effects.status.error describes the
failure.
The status details also carry the ExecutionError, in the same form as
effects.status.error.
Example of an ErrorInfo for a Move abort in the first command:
{ "reason": "TRANSACTION_EXECUTION_FAILED",
"domain": "sui.io",
"metadata": {
"kind": "MOVE_ABORT",
"command": "0"
}
}Metadata:
kind: the failure’sExecutionError.ExecutionErrorKindname.command: index of the command that failed, as a decimal string, or “” if no single command failed.
Implementations§
Source§impl ErrorReason
impl ErrorReason
Source§impl ErrorReason
impl ErrorReason
Sourcepub fn as_str_name(&self) -> &'static str
pub fn as_str_name(&self) -> &'static str
String value of the enum field names used in the ProtoBuf definition.
The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.
Sourcepub fn from_str_name(value: &str) -> Option<Self>
pub fn from_str_name(value: &str) -> Option<Self>
Creates an enum from field names used in the ProtoBuf definition.
Trait Implementations§
Source§impl AsRef<str> for ErrorReason
impl AsRef<str> for ErrorReason
Source§impl Clone for ErrorReason
impl Clone for ErrorReason
Source§fn clone(&self) -> ErrorReason
fn clone(&self) -> ErrorReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ErrorReason
Source§impl Debug for ErrorReason
impl Debug for ErrorReason
Source§impl Default for ErrorReason
impl Default for ErrorReason
Source§fn default() -> ErrorReason
fn default() -> ErrorReason
§impl<'de> Deserialize<'de> for ErrorReason
impl<'de> Deserialize<'de> for ErrorReason
§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for ErrorReason
Source§impl From<ErrorReason> for i32
impl From<ErrorReason> for i32
Source§fn from(value: ErrorReason) -> i32
fn from(value: ErrorReason) -> i32
Source§impl From<ErrorReason> for String
impl From<ErrorReason> for String
Source§fn from(value: ErrorReason) -> Self
fn from(value: ErrorReason) -> Self
Source§impl Hash for ErrorReason
impl Hash for ErrorReason
Source§impl Ord for ErrorReason
impl Ord for ErrorReason
Source§fn cmp(&self, other: &ErrorReason) -> Ordering
fn cmp(&self, other: &ErrorReason) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ErrorReason
impl PartialEq for ErrorReason
Source§impl PartialOrd for ErrorReason
impl PartialOrd for ErrorReason
§impl Serialize for ErrorReason
impl Serialize for ErrorReason
impl StructuralPartialEq for ErrorReason
Source§impl TryFrom<i32> for ErrorReason
impl TryFrom<i32> for ErrorReason
Source§type Error = UnknownEnumValue
type Error = UnknownEnumValue
Source§fn try_from(value: i32) -> Result<ErrorReason, UnknownEnumValue>
fn try_from(value: i32) -> Result<ErrorReason, UnknownEnumValue>
Auto Trait Implementations§
impl Freeze for ErrorReason
impl RefUnwindSafe for ErrorReason
impl Send for ErrorReason
impl Sync for ErrorReason
impl Unpin for ErrorReason
impl UnsafeUnpin for ErrorReason
impl UnwindSafe for ErrorReason
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
U: Sized,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Conv for T
impl<T> Conv for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<'de, T> FromBcs for Twhere
T: Deserialize<'de>,
impl<'de, T> FromBcs for Twhere
T: Deserialize<'de>,
fn from_bcs<'de>(bytes: &'de [u8]) -> Result<Self, Error>where
Self: Deserialize<'de>,
fn from_bcs_base64(base64: &str) -> Result<Self, Error>where
Self: DeserializeOwned,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.