Skip to main content

FacetError

Struct FacetError 

Source
pub struct FacetError {
    pub code: &'static str,
    pub component: &'static str,
    pub n: u32,
    pub message: String,
    pub codeberg_url: String,
}
Expand description

A raised facett UI error — the typed carrier of a facet-<component>-<n> code + its human message + the codeberg source URL. Build it with facet_err!. It renders the message (red) plus the code (pink in debug), folds into state_json via FacetError::to_json, and reports Severity::Error.

Fields§

§code: &'static str

The stable code (facet-<component>-<n>).

§component: &'static str

The component slug.

§n: u32

The per-component number.

§message: String

The human-readable message (UX unchanged; may carry runtime detail).

§codeberg_url: String

The codeberg source URL for the component (resolved from the REGISTRY).

Implementations§

Source§

impl FacetError

Source

pub fn new( component: &'static str, n: u32, code: &'static str, message: impl Into<String>, ) -> Self

Construct from parts — normally called by facet_err!, which supplies the compile-time component/n/code. The codeberg URL is resolved from the REGISTRY (repo root if the code is not yet registered).

Source

pub fn severity(&self) -> Severity

This error’s structural Severity — always Severity::Error (a raised FacetError is RED and fails the Robot-UI gate).

Source

pub fn to_json(&self) -> Value

The observable JSON an error site folds into its pane’s state_json — the CODE (not just the message) so robot tests + consumers key off it: { code, component, n, message, codeberg_url, severity: "error" }.

Source

pub fn reaction(&self) -> Option<Reaction>

The canonical Reaction a consumer must take for this error (Phase 2).

Source

pub fn semantics(&self) -> Semantics

The a11y Semantics for this error — a Severity::Error atom carrying the code, so the Robot-UI gate reads the code straight off the AccessKit tree.

Source

pub fn with_consumer_prefix( &self, prefix: impl Into<String>, ) -> MountedFacetError

Namespace this error with a CONSUMER mount-prefix. A facett component can be mounted in MULTIPLE places in a consuming app (korp mounts facet-map in both its cases and analysis modes), so the consumer prepends ITS OWN mount-prefix when it surfaces/reacts to a facett error: korp/cases:facet-map-2 vs korp/analysis:facet-map-2 — the SAME base facet code facet-map-2, two distinct mount points a robot test can pin apart.

The base facett code stays facet-<component>-<n>; the prefix is additive and applied only by the consumer (this is Phase-1 API that Phase-2 wires in).

Source

pub fn render(&self, ui: &mut Ui) -> Response

Render the error into ui: the human message in the warm failure RED, then the CODE in code_color (clear pink in debug, subdued in release), and an AccessKit node carrying Severity::Error + the code. UX is unchanged (the message is always shown); the pink code is the added diagnostic stripe.

Source

pub fn render_demo(&self, ui: &mut Ui) -> Response

Render for a SHOWCASE / catalog (the facett-demo error-code slide) — the SAME visual (message + pink code chip) as render, but the a11y atom is a neutral Severity::Info Label, NOT an Error. This is what a demonstration surface (which shows error codes on purpose, as a catalog) uses so it does NOT trip the Robot-UI HARD GATE or the deck error-atom net. A LIVE pane raising a real failure uses render.

Trait Implementations§

Source§

impl Clone for FacetError

Source§

fn clone(&self) -> FacetError

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 FacetError

Source§

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

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

impl Eq for FacetError

Source§

impl PartialEq for FacetError

Source§

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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