Trait OffchainStorageError

Source
pub trait OffchainStorageError<Kind>{
    type Error: RuntimeError;

    // Required methods
    fn decode_failed() -> Self::Error;
    fn concurrent_mutation() -> Self::Error;
}
Expand description

Defines how offchain storage failures are reported to callers.

Intended for Substrate FRAME-based runtimes only.

This trait assigns that responsibility to the caller (routine) by allowing it to define the concrete error values used to represent storage failures in its own domain.

The Kind parameter identifies the offchain storage backend this policy applies to (for example, persistent or fork-aware storage). It may carry additional type parameters, but this trait makes no assumptions about their meaning.

This trait defines policy only and introduces no runtime behavior.

Required Associated Types§

Source

type Error: RuntimeError

Caller-defined error type used for storage failures.

The same value is logged and returned as a [DispatchError].

Required Methods§

Source

fn decode_failed() -> Self::Error

Error used when decoding a stored value fails.

Source

fn concurrent_mutation() -> Self::Error

Error used when a concurrent mutation of the stored value is detected.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§