ant_evm/
error.rs

1// Copyright 2024 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use crate::AttoTokens;
10use thiserror::Error;
11
12/// Specialisation of `std::Result`.
13pub type Result<T, E = EvmError> = std::result::Result<T, E>;
14
15#[allow(clippy::large_enum_variant)]
16#[derive(Error, Debug, Clone, PartialEq)]
17#[non_exhaustive]
18/// Transfer errors
19pub enum EvmError {
20    #[error("Lost precision on the number of coins during parsing.")]
21    LossOfPrecision,
22    #[error("The token amount would exceed the maximum value")]
23    ExcessiveValue,
24    #[error("Failed to parse: {0}")]
25    FailedToParseAttoToken(String),
26    #[error("Overflow occurred while adding values")]
27    NumericOverflow,
28    #[error("Not enough balance, {0} available, {1} required")]
29    NotEnoughBalance(AttoTokens, AttoTokens),
30    #[error("Invalid quote public key")]
31    InvalidQuotePublicKey,
32}