Skip to main content

ContractsError

Enum ContractsError 

Source
#[non_exhaustive]
pub enum ContractsError {
Show 27 variants Core(CoreError), Cancelled, UnsupportedChain(u64), DeploymentNotFound { contract: &'static str, chain_id: u64, }, InvalidOrderUidLength { actual: usize, }, UnsupportedSigningScheme(u8), UnknownOrderMarker(B256), UnexpectedEventTopics { event: &'static str, }, InvalidEip1271SignatureData, UnsupportedEip1271Verifier { verifier: Address, }, Eip1271Provider { operation: &'static str, message: Redacted<String>, }, MalformedEip1271Response { response: Redacted<String>, }, Eip1271MagicValueMismatch { expected: [u8; 4], actual: [u8; 4], }, ZeroReceiver, Provider { operation: &'static str, message: Redacted<String>, }, Abi(Error), DecodeHex { field: &'static str, source: FromHexError, }, InvalidHexPrefix { field: &'static str, }, InvalidDecodedLength { field: &'static str, expected: usize, actual: usize, }, FieldTooLarge { field: &'static str, max_bytes: usize, }, Serialization { category: &'static str, line: usize, column: usize, }, InvalidSignatureLength { actual: usize, }, InvalidSignatureRecoveryByte { value: u8, }, SignatureSchemeNotEcdsa, SignatureRecovery { message: Redacted<String>, }, TwapValidation(TwapValidationError), Multiplexer(MultiplexerError),
}
Expand description

Errors returned by low-level CoW contract helpers.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Core(CoreError)

Core validation failed for an input value.

§

Cancelled

A long-running contracts operation was cancelled through a cooperative cancellation token.

§

UnsupportedChain(u64)

A chain id is outside the supported CoW deployment set.

§

DeploymentNotFound

No canonical deployment of the named contract is registered for the chain/environment pair.

Fields

§contract: &'static str

Contract whose deployment is missing.

§chain_id: u64

Chain id with no registered deployment.

§

InvalidOrderUidLength

An order UID had the wrong encoded byte length.

Fields

§actual: usize

Actual decoded byte length.

§

UnsupportedSigningScheme(u8)

A signing-scheme discriminator was not recognized.

§

UnknownOrderMarker(B256)

An order-kind or token-balance marker decoded from an on-chain OrderPlacement event did not match any canonical GPv2 label hash.

§

UnexpectedEventTopics

An on-chain event log carried a topic set that did not match the expected event signature hash or indexed-parameter arity.

Fields

§event: &'static str

Event whose topic set failed validation.

§

InvalidEip1271SignatureData

An encoded EIP-1271 signature payload was malformed.

§

UnsupportedEip1271Verifier

A verifier address did not have contract bytecode.

Fields

§verifier: Address

Verifier address that lacked contract code.

§

Eip1271Provider

The provider failed during an EIP-1271 operation.

Fields

§operation: &'static str

Operation being performed.

§message: Redacted<String>

Provider error message.

§

MalformedEip1271Response

The EIP-1271 call response could not be decoded.

Fields

§response: Redacted<String>

Raw response that failed decoding.

§

Eip1271MagicValueMismatch

The verifier returned an unexpected EIP-1271 magic value.

Fields

§expected: [u8; 4]

Expected 4-byte magic value.

§actual: [u8; 4]

Actual 4-byte magic value returned by the verifier.

§

ZeroReceiver

Contract orders cannot use the zero address as a receiver.

§

Provider

Provider operation failed outside the EIP-1271 helpers.

Fields

§operation: &'static str

Failed provider operation.

§message: Redacted<String>

Provider error message.

§

Abi(Error)

ABI encoding or decoding failed through the alloy-sol-types surface.

§

DecodeHex

Hex decoding failed for a named field; the underlying alloy_primitives::hex::FromHexError is preserved in the error-source chain.

Fields

§field: &'static str

Public field or payload name that failed to decode.

§source: FromHexError

Typed hex-decode error sourced from the decoder.

§

InvalidHexPrefix

A hexadecimal payload was not 0x-prefixed.

Fields

§field: &'static str

Public field or payload name that failed the prefix check.

§

InvalidDecodedLength

A hexadecimal payload decoded to an unexpected byte length.

Fields

§field: &'static str

Public field or payload name that failed the length check.

§expected: usize

Expected decoded byte length.

§actual: usize

Actual decoded byte length.

§

FieldTooLarge

A hexadecimal payload exceeded the maximum decoded byte length permitted for its field.

Fields

§field: &'static str

Public field or payload name that exceeded the limit.

§max_bytes: usize

Maximum decoded byte length permitted for the field.

§

Serialization

JSON serialization or decoding failed.

Only the serde failure category and the structural position are surfaced. The raw serde_json::Error rendering can echo bytes from a decoded payload, so the conversion drops it (ADR 0025); the category/line/column triple is the safe structural diagnostic, mirroring cow_sdk_orderbook::OrderbookError::Serialization.

Fields

§category: &'static str

serde failure category: "syntax", "data", "eof", or "io".

§line: usize

1-based line where decoding failed, or 0 when the position is unknown.

§column: usize

1-based column where decoding failed, or 0 when the position is unknown.

§

InvalidSignatureLength

Signature byte length is not the required 65.

Fields

§actual: usize

Observed byte length.

§

InvalidSignatureRecoveryByte

Recovery byte is outside the accepted {0, 1, 27, 28} set.

Fields

§value: u8

Rejected recovery byte value.

§

SignatureSchemeNotEcdsa

A non-ECDSA signature variant was passed to an ECDSA-only helper.

§

SignatureRecovery

ECDSA public-key recovery failed.

Fields

§message: Redacted<String>

Sanitized recovery failure description from the backend.

§

TwapValidation(TwapValidationError)

Available on crate feature composable only.

Composable TWAP inputs failed client-side validation.

§

Multiplexer(MultiplexerError)

Available on crate feature composable only.

A composable conditional-order multiplexer operation failed.

Implementations§

Source§

impl ContractsError

Source

pub const fn class(&self) -> ErrorClass

Returns the coarse-grained ErrorClass for this error.

Trait Implementations§

Source§

impl Debug for ContractsError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ContractsError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ContractsError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Cancelled> for ContractsError

Source§

fn from(_: Cancelled) -> Self

Converts to this type from the input type.
Source§

impl From<CoreError> for ContractsError

Source§

fn from(source: CoreError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ContractsError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ContractsError

Source§

fn from(error: Error) -> Self

Captures only the serde failure category and structural position.

The raw serde_json::Error rendering can echo bytes from a decoded payload, so it is intentionally dropped here (ADR 0025); only the category/line/column triple is retained.

Source§

impl From<MultiplexerError> for ContractsError

Source§

fn from(source: MultiplexerError) -> Self

Converts to this type from the input type.
Source§

impl From<TwapValidationError> for ContractsError

Source§

fn from(source: TwapValidationError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more