Skip to main content

OrmError

Enum OrmError 

Source
pub enum OrmError {
Show 14 variants InvalidIdentifier(String), Empty(&'static str), BadExpr(&'static str), TenancyUndeclared(String), UnscopedWrite(String), TenancyNoPrincipal, PublicSubsetUndeclared(String), TargetWriteNotGranted(String), TargetWriteColumnDenied(String), TargetDeleteRefused(String), PublicSubsetNotForceable(String), TargetWriteUnsupported(&'static str), TargetUpsertKeyMissingTenant(String), TargetWriteToSessionTable(String),
}
Expand description

Why compilation failed.

Variants§

§

InvalidIdentifier(String)

An identifier was not a plain [A-Za-z_][A-Za-z0-9_]* (optionally table.column) name.

§

Empty(&'static str)

The query was structurally empty (no rows to insert, no columns to set, …).

§

BadExpr(&'static str)

A function was called with the wrong number of arguments, or * was used outside count(*).

§

TenancyUndeclared(String)

A scoped query touched a table with no entry in the project’s [TenancySchema] (deny-by-default, PLAN-tenancy-principal D3): “no key” and “forgot the key” are indistinguishable, so the safe collapse is to refuse rather than run it unscoped or wrongly scoped. Unscoped is the explicit, reviewed “this table is global”; an absent table is a misconfiguration the host surfaces (the binding names the component + marker site).

§

UnscopedWrite(String)

A guest WRITE (INSERT/UPDATE/DELETE) targeted a table declared Unscoped (global reference data). Reads of an Unscoped table are global by design, but writes are deny-by-default (a shared-data write is a cross-tenant blast — the TableScope::Unscoped contract), so the host refuses them rather than running the write unbounded-by-tenant.

§

TenancyNoPrincipal

A scoped read/write needed a resolved principal (an own-tenant value, or — for a TenantOrSession table — at least one of the tenant/session facts) but the request carried none. Fail closed: the query is refused rather than run unscoped. (The single-column raw-SQL path reports the equivalent TenantDenied::NoSource at the binding.)

§

PublicSubsetUndeclared(String)

A target read (R4/D8) touched a table with no declared public subset in the project schema. A target scope may only read rows that satisfy each accessed table’s host-held public predicate, so a table (root or any joined/subquery ref) that declares none is refused — deny-by-default, the strict analog of [TenancyUndeclared]. This is what keeps a target read from ever reaching another tenant’s PRIVATE rows through an un-confined table.

§

TargetWriteNotGranted(String)

A WRITE (INSERT/UPDATE) was force-scoped under a target scope whose SET-allowlist is empty — i.e. a target route with no write grant is read-only (5b, deny-by-default). Refused before any SQL.

§

TargetWriteColumnDenied(String)

A target write tried to set a column that is not in the route’s SET-allowlist — the tenant column, a public-visibility column, or any other un-granted column. Refused fail-closed so a target write can never change ownership, flip visibility, or touch a non-granted column.

§

TargetDeleteRefused(String)

A DELETE was attempted under a target scope. Target writes are INSERT/UPDATE only; a target DELETE is always refused (a cross-tenant delete is never granted).

§

PublicSubsetNotForceable(String)

A target INSERT could not force a table’s public subset to a concrete row: a public term that is not column = <literal> or column IS NULL (e.g. a range or IS NOT NULL) has no single value to stamp, so the host cannot guarantee the inserted row lands in the public subset — refused (deny-by-default). Such a subset is read-/update-only, never target-insertable.

§

TargetWriteUnsupported(&'static str)

A target write used a shape the confinement does not support: an INSERT … SELECT, an ON CONFLICT upsert on an anonymous (domain/handle/target_or_null) target, or a promote. These could reach rows outside the public subset (a selected source; or a conflict-row DO UPDATE whose tenant = B guard carries no visibility subset, so an anonymous upsert could touch B’s non-public row). A capability-axis ON CONFLICT … DO UPDATE upsert IS supported (own↔target parity — see Insert::confine_target_insert); the rest are refused.

§

TargetUpsertKeyMissingTenant(String)

A capability-axis target upsert (ON CONFLICT … DO UPDATE) whose conflict target does NOT include the table’s tenant column. Required so a conflict is always a same-tenant (B) row: otherwise B’s INSERT could conflict with another tenant A’s row on a tenant-agnostic natural key, and the tenant = B-guarded DO UPDATE would silently no-op — dropping B’s write AND leaking that A holds that key (a cross-tenant existence oracle). Refused fail-closed; add the tenant column to the conflict target (e.g. (tenant_id, …)).

§

TargetWriteToSessionTable(String)

A target write (INSERT/UPDATE) touched a TenantOrSession (anonymous-session-keyed) table. A target principal carries only the target tenant B (no session fact), so the host cannot write such a row session-scoped — it could only stamp tenant = B, which would silently claim an anon/session-owned row for B and break the anon→promotion model. Refused deny-by-default: write a TenantOrSession table on the caller’s own/session-scoped path, never under a target scope. (PLAN-delegable-capabilities, Stage A.)

Trait Implementations§

Source§

impl Clone for OrmError

Source§

fn clone(&self) -> OrmError

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 OrmError

Source§

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

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

impl Display for OrmError

Source§

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

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

impl Error for OrmError

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 OrmError

Source§

fn eq(&self, other: &OrmError) -> 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 OrmError

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