M2MError

Enum M2MError 

Source
pub enum M2MError {
Show 23 variants Compression(String), Decompression(String), InvalidCodec(String), Protocol(String), NegotiationFailed(String), SessionNotEstablished, SessionExpired, InvalidMessage(String), CapabilityMismatch(String), ModelNotLoaded(String), ModelNotFound(String), Tokenizer(String), Config(String), Json(Error), Network(String), Upstream(String), Server(String), Inference(String), ModelLoad(String), Io(Error), Crypto(CryptoError), SecurityThreat { threat_type: String, confidence: f32, }, ContentBlocked(String),
}
Expand description

M2M Protocol errors, organized by epistemic category.

See module documentation for the full epistemic taxonomy.

Variants§

§

Compression(String)

Compression failed due to invalid input or unsupported content.

Epistemic: B_i falsified — caller believed content was compressible.

§

Decompression(String)

Decompression failed due to corrupted or invalid wire format.

Epistemic: B_i falsified — caller believed data was valid M2M format.

§

InvalidCodec(String)

Codec identifier not recognized or not supported.

Epistemic: B_i falsified — caller believed codec was available.

§

Protocol(String)

Protocol state machine violation.

Epistemic: B_i falsified — caller believed operation was valid in current state.

§

NegotiationFailed(String)

Session handshake failed to agree on capabilities.

Epistemic: B_i falsified — caller believed negotiation would succeed.

§

SessionNotEstablished

Operation requires an established session, but session is not ready.

Epistemic: B_i falsified — caller believed session was established.

§

SessionExpired

Session has exceeded its timeout duration.

Epistemic: B_i falsified — caller believed session was still valid.

§

InvalidMessage(String)

Message does not conform to expected format.

Epistemic: B_i falsified — caller believed message was well-formed.

§

CapabilityMismatch(String)

Peers have incompatible capabilities for the requested operation.

Epistemic: B_i falsified — caller believed capabilities were compatible.

§

ModelNotLoaded(String)

ML model was expected to be loaded but isn’t.

Epistemic: B_i falsified — caller believed model was available.

§

ModelNotFound(String)

Requested model not found in the registry.

Epistemic: B_i falsified — caller believed model existed.

§

Tokenizer(String)

Tokenizer operation failed (invalid encoding, unknown token).

Epistemic: B_i falsified — caller believed input was tokenizable.

§

Config(String)

Configuration is invalid or missing required values.

Epistemic: B_i falsified — caller believed config was valid.

§

Json(Error)

JSON serialization/deserialization failed.

Epistemic: B_i falsified — caller believed data was valid JSON.

§

Network(String)

Network operation failed (connection, timeout, DNS).

Epistemic: I^B materialized — network availability was unknown until we attempted the operation.

Handling: Retry with exponential backoff, circuit breaker.

§

Upstream(String)

Upstream service returned an error or is unavailable.

Epistemic: I^B materialized — upstream health was unknown until we made the request.

Handling: Retry, failover to alternate upstream, degrade gracefully.

§

Server(String)

Server-side processing error.

Epistemic: I^B materialized — server state was unknown to client.

§

Inference(String)

ML inference failed during execution.

Epistemic: I^B materialized — model execution success depends on input characteristics and runtime state.

§

ModelLoad(String)

Failed to load ML model from filesystem or network.

Epistemic: I^B materialized — model file availability unknown until load attempted.

§

Io(Error)

I/O operation failed.

Epistemic: I^B materialized — filesystem/resource state unknown until operation attempted.

§

Crypto(CryptoError)

Cryptographic operation failed (key derivation, encryption, auth).

Epistemic: Mixed — may be B_i (invalid key) or I^B (RNG failure). The inner CryptoError provides specific classification.

This variant preserves the full error chain via #[source], enabling tools like anyhow to display complete context.

§

SecurityThreat

Security scanner detected a threat in content.

Epistemic: B_i falsified — content was believed to be safe.

Handling: Do NOT retry, log for security audit, consider blocking source.

Fields

§threat_type: String

Type of threat detected (e.g., “prompt_injection”, “jailbreak”).

§confidence: f32

Detection confidence score (0.0-1.0).

§

ContentBlocked(String)

Content blocked by security policy.

Epistemic: B_i falsified — content was believed to comply with policy.

Handling: Do NOT retry, inform user of policy violation.

Implementations§

Source§

impl M2MError

Source

pub fn is_retryable(&self) -> bool

Returns true if this error is retryable.

I^B errors (network, upstream, inference) are generally retryable. B_i errors (validation failures) are NOT retryable without changes.

§Example
match operation() {
    Err(e) if e.is_retryable() => retry_with_backoff(operation),
    Err(e) => return Err(e),
    Ok(v) => v,
}
Source

pub fn is_security_error(&self) -> bool

Returns true if this error is security-related.

Security errors should NOT be retried and may warrant special logging.

Source

pub fn is_bounded_ignorance(&self) -> bool

Returns true if this error indicates bounded ignorance (I^B).

These errors stem from external system state that was unknown at compile time.

Source

pub fn is_belief_falsified(&self) -> bool

Returns true if this error indicates a falsified belief (B_i).

These errors indicate the caller made an incorrect assumption about input validity or system state.

Trait Implementations§

Source§

impl Debug for M2MError

Source§

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

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

impl Display for M2MError

Source§

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

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

impl Error for M2MError

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<CryptoError> for M2MError

Source§

fn from(err: CryptoError) -> Self

Converts to this type from the input type.
Source§

impl From<DecodeError> for M2MError

Source§

fn from(err: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for M2MError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for M2MError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for M2MError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for M2MError

Source§

fn from(err: Error) -> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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> ToCompactString for T
where T: Display,

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

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,