Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 68 variants InvalidKeyLength { expected: usize, actual: usize, }, InvalidDataLength { expected: usize, actual: usize, }, InvalidHex(String), InvalidBase58(String), InvalidBase64(String), CryptoError(String), InvalidSignature(String), InvalidPublicKey(String), InvalidPrivateKey(String), PointAtInfinity, DecryptionFailed, InvalidNonce(String), InvalidTag, InvalidUtf8(String), ReaderUnderflow { needed: usize, available: usize, }, NonCanonicalVarInt { width: u8, value: u64, }, CompactSizeTooLarge(u64), InvalidChecksum, ScriptParseError(String), ScriptExecutionError(String), InvalidOpcode(u8), DisabledOpcode(u8), StackUnderflow, StackOverflow, Bip276Error(String), InvalidAddress(String), InvalidAddressLength(String), UnsupportedAddress(String), TransactionError(String), MerklePathError(String), BeefError(String), FeeModelError(String), WalletError(String), WalletBusy { detail: String, retry_after_ms: Option<u64>, }, WalletTransport { status: Option<u16>, detail: String, }, KeyDerivationError(String), ProtocolValidationError(String), InvalidCounterparty(String), MessageVersionMismatch { expected: String, actual: String, }, MessageError(String), MessageRecipientMismatch { expected: String, actual: String, }, InvalidMnemonic(String), InvalidEntropyLength { expected: String, actual: usize, }, InvalidMnemonicWord(String), InvalidExtendedKey(String), HardenedFromPublic, InvalidDerivationPath(String), EciesDecryptionFailed(String), EciesHmacMismatch, AuthError(String), SessionNotFound(String), CertificateValidationError(String), TransportError(String), OverlayError(String), NoHostsFound(String), OverlayBroadcastFailed(String), RegistryError(String), DefinitionNotFound(String), InvalidDefinitionData(String), KvStoreError(String), KvStoreKeyNotFound(String), KvStoreCorruptedState(String), KvStoreEmptyContext, KvStoreInvalidKey, KvStoreInvalidValue, IdentityError(String), IdentityNotFound(String), ContactNotFound(String),
}
Expand description

Main error type for the BSV SDK.

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.
§

InvalidKeyLength

Invalid key length for cryptographic operations.

Fields

§expected: usize

The length the operation requires, in bytes.

§actual: usize

The length supplied, in bytes.

§

InvalidDataLength

Invalid data length for cryptographic operations.

Fields

§expected: usize

The length the operation requires, in bytes.

§actual: usize

The length supplied, in bytes.

§

InvalidHex(String)

Invalid hex string.

§

InvalidBase58(String)

Invalid base58 string.

§

InvalidBase64(String)

Invalid base64 string.

§

CryptoError(String)

Cryptographic operation failed.

§

InvalidSignature(String)

Invalid signature.

§

InvalidPublicKey(String)

Invalid public key.

§

InvalidPrivateKey(String)

Invalid private key.

§

PointAtInfinity

Point at infinity (invalid for most operations).

§

DecryptionFailed

Decryption failed.

§

InvalidNonce(String)

Invalid nonce.

§

InvalidTag

Invalid tag (for authenticated encryption).

§

InvalidUtf8(String)

Invalid UTF-8 sequence.

§

ReaderUnderflow

Reader underflow (not enough bytes to read).

Fields

§needed: usize

The bytes the read asked for.

§available: usize

The bytes left in the reader.

§

NonCanonicalVarInt

A varint using more bytes than its value requires. Width includes the marker.

Fields

§width: u8

The encoded width in bytes, the marker included.

§value: u64

The value the varint carries.

§

CompactSizeTooLarge(u64)

A node CompactSize above MAX_COMPACT_SIZE.

§

InvalidChecksum

Invalid checksum.

§

ScriptParseError(String)

Script parse error.

§

ScriptExecutionError(String)

Script execution error.

§

InvalidOpcode(u8)

Invalid opcode.

§

DisabledOpcode(u8)

Disabled opcode.

§

StackUnderflow

Stack underflow.

§

StackOverflow

Stack overflow.

§

Bip276Error(String)

BIP-276 encoding/decoding error.

§

InvalidAddress(String)

Invalid address.

§

InvalidAddressLength(String)

Invalid address length.

§

UnsupportedAddress(String)

Unsupported address type.

§

TransactionError(String)

Transaction error.

§

MerklePathError(String)

MerklePath error.

§

BeefError(String)

BEEF format error.

§

FeeModelError(String)

Fee model error.

§

WalletError(String)

General wallet error.

§

WalletBusy

The wallet is busy: a refusal before acting, in the wallet’s word.

The wallet answered that it refused the call before acting (a contended store, a lock not acquired) and promised that nothing was written, built or locked, so the caller may repeat the same call unchanged after retry_after_ms, or after a moment when it is None. The SDK reports the server’s promise; it cannot check it. HttpWalletJson reads it from the body’s code (STORE_BUSY, ERR_SERVER_BUSY), never from the HTTP status; a 503 without that code is Error::WalletTransport.

Fields

§detail: String

What was busy, in the wallet’s words.

§retry_after_ms: Option<u64>

How long the wallet asks the caller to wait before repeating the call, in milliseconds; None when it did not say. Unbounded: the server’s word, not checked (a huge Retry-After saturates to u64::MAX), so a caller caps its own wait.

§

WalletTransport

The way to the wallet failed: no answer in the wallet’s word.

A caller may retry it; it carries no promise about what the wallet did (the request may or may not have reached it), which is the one way it differs from Error::WalletBusy. HttpWalletJson answers it for a 502, 503 or 504 whose body carries no busy code and no numeric wallet code, a connection error (refused, reset, DNS) and a timeout; every other failure, and every refusal, stays Error::WalletError. The crate never retries by itself.

Fields

§status: Option<u16>

The HTTP status of the answer, when one arrived (502, 503 or 504); None when no answer arrived (a connection error, a timeout).

§detail: String

What failed, in the transport’s words.

§

KeyDerivationError(String)

Key derivation error.

§

ProtocolValidationError(String)

Protocol validation error.

§

InvalidCounterparty(String)

Invalid counterparty.

§

MessageVersionMismatch

Message version mismatch.

Fields

§expected: String

The version prefix this crate reads, as hex.

§actual: String

The version prefix the message carries, as hex.

§

MessageError(String)

General message error.

§

MessageRecipientMismatch

Message recipient mismatch.

Fields

§expected: String

The recipient public key the message names, compressed, as hex.

§actual: String

The public key of the private key supplied to read it, compressed, as hex.

§

InvalidMnemonic(String)

Invalid mnemonic phrase.

§

InvalidEntropyLength

Invalid entropy length for mnemonic generation.

Fields

§expected: String

The entropy lengths accepted, in bits.

§actual: usize

The entropy length supplied, in bits.

§

InvalidMnemonicWord(String)

Invalid word in mnemonic phrase.

§

InvalidExtendedKey(String)

Invalid extended key.

§

HardenedFromPublic

Cannot derive hardened child from public key.

§

InvalidDerivationPath(String)

Invalid derivation path.

§

EciesDecryptionFailed(String)

ECIES decryption failed.

§

EciesHmacMismatch

ECIES HMAC verification failed.

§

AuthError(String)

General authentication error.

§

SessionNotFound(String)

Session not found.

§

CertificateValidationError(String)

Certificate validation failed.

§

TransportError(String)

Transport error.

§

OverlayError(String)

General overlay error.

§

NoHostsFound(String)

No hosts found for service.

§

OverlayBroadcastFailed(String)

Broadcast to overlay failed.

§

RegistryError(String)

General registry error.

§

DefinitionNotFound(String)

Definition not found in registry.

§

InvalidDefinitionData(String)

Invalid definition data.

§

KvStoreError(String)

General kvstore error.

§

KvStoreKeyNotFound(String)

Key not found in kvstore.

§

KvStoreCorruptedState(String)

Corrupted kvstore state.

§

KvStoreEmptyContext

Empty context (protocol_id) provided to kvstore.

§

KvStoreInvalidKey

Invalid key provided to kvstore (empty).

§

KvStoreInvalidValue

Invalid value provided to kvstore (empty).

§

IdentityError(String)

General identity error.

§

IdentityNotFound(String)

Identity not found.

§

ContactNotFound(String)

Contact not found.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

1.30.0 · 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 PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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