Skip to main content

UniError

Enum UniError 

Source
#[non_exhaustive]
pub enum UniError {
Show 53 variants NotFound { path: PathBuf, }, Schema { message: String, }, Parse { message: String, position: Option<usize>, line: Option<usize>, column: Option<usize>, context: Option<String>, }, Query { message: String, query: Option<String>, }, Transaction { message: String, }, TransactionConflict { message: String, }, TransactionAlreadyCompleted, TransactionRollbackOnly, ReadOnly { operation: String, }, LabelNotFound { label: String, }, EdgeTypeNotFound { edge_type: String, }, PropertyNotFound { property: String, entity_type: String, label: String, }, IndexNotFound { index: String, }, SnapshotNotFound { snapshot_id: String, }, MemoryLimitExceeded { limit_bytes: usize, }, DatabaseLocked, Timeout { timeout_ms: u64, }, LocyIncomplete { detail: Box<LocyIncomplete>, }, Type { expected: String, actual: String, }, Constraint { message: String, }, SerializationConflict { message: String, }, ConstraintConflict { message: String, }, Storage { message: String, source: Option<Box<dyn Error + Send + Sync>>, }, Io(Error), Internal(Error), InvalidIdentifier { name: String, reason: String, }, LabelAlreadyExists { label: String, }, EdgeTypeAlreadyExists { edge_type: String, }, PermissionDenied { action: String, }, InvalidArgument { arg: String, message: String, }, WriteContextAlreadyActive { session_id: String, hint: &'static str, }, CommitTimeout { tx_id: String, hint: &'static str, }, LockTimeout { timeout_ms: u64, }, TransactionExpired { tx_id: String, hint: &'static str, }, Cancelled, StaleDerivedFacts { version_gap: u64, }, RuleConflict { rule_name: String, }, HookRejected { message: String, }, TriggerRejected { trigger: String, reason: String, }, AuthenticationFailed { reason: String, }, AuthorizationDenied { reason: String, }, EphemeralWriteAttempt { kind: &'static str, id: u64, }, ForkNotFound { name: String, }, ForkAlreadyExists { name: String, }, ForkWritesNotYetSupported, ForkInUse { name: String, holder_count: usize, }, ForkInflightTx { name: String, }, PendingFlushTimeout { name: String, }, ForkCorruptRegistry { message: String, }, ForkHasChildren { name: String, children: Vec<String>, }, ForkSubtreeInUse { blockers: Vec<String>, }, ForkBudgetExceeded { current: usize, max: usize, }, ForkLifecycle { name: String, stage: &'static str, source: Box<dyn Error + Send + Sync>, },
}

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

NotFound

Fields

§path: PathBuf
§

Schema

Fields

§message: String
§

Parse

Fields

§message: String
§position: Option<usize>
§column: Option<usize>
§context: Option<String>
§

Query

Fields

§message: String
§

Transaction

Fields

§message: String
§

TransactionConflict

Fields

§message: String
§

TransactionAlreadyCompleted

§

TransactionRollbackOnly

A previous statement in this transaction failed, marking it rollback-only.

Once any statement returns an error, the transaction is poisoned: it has possibly half-applied rows in its private buffer, so it is no longer committable (Neo4j-style rollback-only semantics). All further statements and commit() are rejected with this error; only rollback() (or drop) succeeds, discarding the partial writes. Start a fresh transaction to retry.

§

ReadOnly

Operation not supported on read-only database

Fields

§operation: String
§

LabelNotFound

Label not found in schema

Fields

§label: String
§

EdgeTypeNotFound

Edge type not found in schema

Fields

§edge_type: String
§

PropertyNotFound

Property not found on node/edge

Fields

§property: String
§entity_type: String
§label: String
§

IndexNotFound

Index not found

Fields

§index: String
§

SnapshotNotFound

Snapshot not found

Fields

§snapshot_id: String
§

MemoryLimitExceeded

Query memory limit exceeded

Fields

§limit_bytes: usize
§

DatabaseLocked

§

Timeout

Fields

§timeout_ms: u64
§

LocyIncomplete

A Locy program stopped before reaching its least fixed point because it exceeded its wall-clock timeout or its max_iterations cap.

This is the default outcome of an over-budget evaluation: partial results are not returned silently. The boxed LocyIncomplete carries the diagnostics (which rules were skipped, which complement rules are now unsound, how far evaluation got). The partial facts themselves are not embedded here — to recover them, re-run with allow_partial set, which returns Ok with the partial result instead of this error.

Fields

§

Type

Fields

§expected: String
§actual: String
§

Constraint

Fields

§message: String
§

SerializationConflict

A transaction was aborted at commit because a concurrent transaction committed a conflicting write since this transaction began (optimistic concurrency control). The transaction may be safely retried.

Fields

§message: String
§

ConstraintConflict

A transaction was aborted at commit because a concurrent transaction committed a row with the same unique key (serializable MERGE). The transaction may be safely retried, which will observe the existing row.

Fields

§message: String
§

Storage

Fields

§message: String
§source: Option<Box<dyn Error + Send + Sync>>
§

Io(Error)

§

Internal(Error)

§

InvalidIdentifier

Fields

§name: String
§reason: String
§

LabelAlreadyExists

Fields

§label: String
§

EdgeTypeAlreadyExists

Fields

§edge_type: String
§

PermissionDenied

Fields

§action: String
§

InvalidArgument

Fields

§message: String
§

WriteContextAlreadyActive

Write context (transaction, bulk writer, or appender) is already active on session.

Fields

§session_id: String
§hint: &'static str
§

CommitTimeout

Transaction commit timed out waiting for the global writer lock.

Fields

§tx_id: String
§hint: &'static str
§

LockTimeout

A FOR UPDATE pessimistic row lock could not be acquired within the deadline — the holder is another live transaction (contention or a lock-ordering deadlock). Unlike a plain UniError::Timeout (a slow operation that would just time out again), this is transient: a fresh transaction can retry and win the lock once the holder releases it, so it is classified retriable. See is_retriable.

Fields

§timeout_ms: u64
§

TransactionExpired

Transaction exceeded its deadline.

Fields

§tx_id: String
§hint: &'static str
§

Cancelled

Operation was cancelled via a cancellation token.

§

StaleDerivedFacts

Derived facts are stale relative to the current database version.

Fields

§version_gap: u64
§

RuleConflict

A Locy rule conflict was detected during transaction commit rule promotion.

Fields

§rule_name: String
§

HookRejected

A session hook rejected the operation.

Fields

§message: String
§

TriggerRejected

A synchronous trigger returned TriggerOutcome::Reject (or Err) during a BeforeMutation / BeforeCommit phase, aborting commit.

Fields

§trigger: String
§reason: String
§

AuthenticationFailed

Authentication failed (M5i). Raised when Uni::session_with_credentials cannot find a matching AuthProvider or the matched provider rejects the credentials.

Fields

§reason: String

Human-readable failure reason.

§

AuthorizationDenied

An AuthzPolicy::check returned Decision::Deny for the current principal (M5i).

Fields

§reason: String

Reason from the deciding policy.

§

EphemeralWriteAttempt

A write was attempted against an ephemeral (transient, in-query) node or edge — i.e. one whose Vid / Eid has the EPHEMERAL_BIT set. Ephemeral entities are return-only projections; SET / DELETE / MERGE against them must fail before they reach storage (M5g / proposal §4.13.1).

Fields

§kind: &'static str

"node" or "edge".

§id: u64

Transient id (bottom 63 bits) for diagnostic output.

§

ForkNotFound

Fork with the given name does not exist in the registry.

Fields

§name: String
§

ForkAlreadyExists

session.fork(name).new_() was called against an existing fork.

Fields

§name: String
§

ForkWritesNotYetSupported

Phase-1 gate: writes through forked_session.tx() are blocked until Phase 2 lands. Reads, locy(), and admin paths work.

§

ForkInUse

Drop refused because forked sessions are still alive on the fork.

Fields

§name: String
§holder_count: usize
§

ForkInflightTx

Drop refused because a transaction has uncommitted mutations on the fork. Commit or roll back the transaction first, then retry drop.

Fields

§name: String
§

PendingFlushTimeout

Drop refused because the fork has pending async flushes that did not drain within UniConfig::drop_fork_drain_timeout. Either retry later (the streams will eventually complete) or raise the timeout.

Fields

§name: String
§

ForkCorruptRegistry

Registry on disk is malformed (corrupt JSON, missing required field, etc.).

Fields

§message: String
§

ForkHasChildren

Drop refused because this fork has nested children. Use drop_fork_cascade to remove the whole subtree, or drop the children individually first.

Fields

§name: String
§children: Vec<String>
§

ForkSubtreeInUse

drop_fork_cascade refused because at least one fork in the subtree has live sessions or in-flight transactions. No branch has been deleted yet — the cascade is atomic at the validation step. Resolve the blockers and retry.

Fields

§blockers: Vec<String>
§

ForkBudgetExceeded

Session::fork(name) refused because the configured max_forks budget is at capacity. Drop existing forks (or wait for the sweeper to reap expired ones) and retry. Counts include Active, Pending, and Tombstoned entries.

Fields

§current: usize
§max: usize
§

ForkLifecycle

2PC step on a fork lifecycle operation failed.

stage names the step (registry_pending, create_branch, registry_active, tombstone, delete_branch, registry_clear, backend_unsupported, recovery) so recovery and humans can triage without parsing prose.

Fields

§name: String
§stage: &'static str
§source: Box<dyn Error + Send + Sync>

Implementations§

Source§

impl UniError

Source

pub fn is_retriable(&self) -> bool

Returns true when retrying the failed operation from scratch may succeed.

Distinguishes transient contention failures — optimistic-concurrency aborts and lock/commit timeouts, which a fresh transaction can win — from deterministic failures (bad query, schema or type violation) that would fail identically on retry. This is the signal Session::transact_with_retry uses to decide whether to re-run a transaction closure.

TransactionExpired is deliberately not retriable here: a fresh transaction gets a new deadline, but the helper treats deadline expiry as a caller-set budget, not a contention signal. A plain Timeout is likewise not retriable — re-running the same slow operation would just time out again; only CommitTimeout (lock contention at the commit point) and LockTimeout (a contended FOR UPDATE row lock / deadlock) signal retriable contention.

§Examples
use uni_common::UniError;

assert!(UniError::SerializationConflict { message: "lost update".into() }.is_retriable());
assert!(!UniError::Schema { message: "no such label".into() }.is_retriable());

Trait Implementations§

Source§

impl Debug for UniError

Source§

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

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

impl Display for UniError

Source§

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

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

impl Error for UniError

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<Error> for UniError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for UniError

Source§

fn from(source: 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<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> 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> 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> 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 = 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