use crate::ContractTypeSpec;
use crate::exn::fault::*;
use crate::xdr::*;
use core::fmt::Debug;
#[cfg(not(target_arch = "riscv32"))]
use thiserror::Error;
#[derive(
Debug, PartialEq, ReadXDR, WriteXDR, ContractTypeSpec, ConstXDRSize,
)]
#[cfg_attr(not(target_arch = "riscv32"), derive(Error))]
#[repr(i32)]
pub enum CallingError {
#[cfg_attr(
not(target_arch = "riscv32"),
error("Invalid call: contract not found (or bad auth tokens)")
)]
Invalid = 0,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Decoding a successful result: {0}")
)]
DecodingSuccess(FaultString) = 1,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Decoding an exception result: {0}")
)]
DecodingException(FaultString) = 2,
#[cfg_attr(not(target_arch = "riscv32"), error("Encoding arguments: {0}"))]
EncodingArgs(FaultString) = 3,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Invalid call: target already has an open frame (reentrant)")
)]
Reentrance = 4,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Invalid call: cross-invoke depth bound reached")
)]
DepthExceeded = 5,
}
impl crate::re_throw::ReThrow for CallingError {
#[cfg_attr(not(target_arch = "riscv32"), track_caller)]
fn re_throw(self) -> ! {
crate::exn::client_library_throw(self)
}
}
#[derive(
Debug, PartialEq, ReadXDR, WriteXDR, ContractTypeSpec, ConstXDRSize,
)]
#[cfg_attr(not(target_arch = "riscv32"), derive(Error))]
#[repr(i32)]
pub enum HandlingError {
#[cfg_attr(
not(target_arch = "riscv32"),
error("Decoding argument data: {0}")
)]
DecodingArgs(FaultString) = 0,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Encoding successful result: {0}")
)]
EncodingSuccess(FaultString) = 1,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Encoding exception result: {0}")
)]
EncodingException(FaultString) = 2,
#[cfg_attr(not(target_arch = "riscv32"), error("Encoding event: {0}"))]
EncodingEvent(FaultString) = 3,
}
#[derive(
Debug, PartialEq, ReadXDR, WriteXDR, ContractTypeSpec, ConstXDRSize,
)]
#[cfg_attr(not(target_arch = "riscv32"), derive(Error))]
#[repr(i32)]
pub enum AuthTokenError {
#[cfg_attr(
not(target_arch = "riscv32"),
error("Encoding auth token: {0}")
)]
MintEncodeFailure(FaultString) = 0,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Decoding auth token payload: {0}")
)]
ConsumeDecodeFailure(FaultString) = 1,
#[cfg_attr(
not(target_arch = "riscv32"),
error("Receiving auth token handles: {0}")
)]
ReceiveAuthHandlesFailure(FaultString) = 2,
}
impl crate::__contract_spec::ContractTypeName for CallingError {
const NAME: crate::__contract_spec::ContractSpecIdView<'static> =
crate::__contract_spec::ContractSpecIdView {
crate_name: ::core::env!("CARGO_PKG_NAME"),
major: crate::exn::EXN_ABI_MAJOR,
module_path: ::core::module_path!(),
declared: "CallingError",
};
}
impl crate::__contract_spec::ContractTypeName for HandlingError {
const NAME: crate::__contract_spec::ContractSpecIdView<'static> =
crate::__contract_spec::ContractSpecIdView {
crate_name: ::core::env!("CARGO_PKG_NAME"),
major: crate::exn::EXN_ABI_MAJOR,
module_path: ::core::module_path!(),
declared: "HandlingError",
};
}
impl crate::__contract_spec::ContractTypeName for AuthTokenError {
const NAME: crate::__contract_spec::ContractSpecIdView<'static> =
crate::__contract_spec::ContractSpecIdView {
crate_name: ::core::env!("CARGO_PKG_NAME"),
major: crate::exn::EXN_ABI_MAJOR,
module_path: ::core::module_path!(),
declared: "AuthTokenError",
};
}