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 strThe stable code (facet-<component>-<n>).
component: &'static strThe component slug.
n: u32The per-component number.
message: StringThe human-readable message (UX unchanged; may carry runtime detail).
codeberg_url: StringThe codeberg source URL for the component (resolved from the REGISTRY).
Implementations§
Source§impl FacetError
impl FacetError
Sourcepub fn new(
component: &'static str,
n: u32,
code: &'static str,
message: impl Into<String>,
) -> Self
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).
Sourcepub fn severity(&self) -> Severity
pub fn severity(&self) -> Severity
This error’s structural Severity — always
Severity::Error (a raised FacetError is RED and
fails the Robot-UI gate).
Sourcepub fn to_json(&self) -> Value
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" }.
Sourcepub fn reaction(&self) -> Option<Reaction>
pub fn reaction(&self) -> Option<Reaction>
The canonical Reaction a consumer must take for this error (Phase 2).
Sourcepub fn semantics(&self) -> Semantics
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.
Sourcepub fn with_consumer_prefix(
&self,
prefix: impl Into<String>,
) -> MountedFacetError
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).
Sourcepub fn render(&self, ui: &mut Ui) -> Response
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.
Sourcepub fn render_demo(&self, ui: &mut Ui) -> Response
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
impl Clone for FacetError
Source§fn clone(&self) -> FacetError
fn clone(&self) -> FacetError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FacetError
impl Debug for FacetError
impl Eq for FacetError
Source§impl PartialEq for FacetError
impl PartialEq for FacetError
impl StructuralPartialEq for FacetError
Auto Trait Implementations§
impl Freeze for FacetError
impl RefUnwindSafe for FacetError
impl Send for FacetError
impl Sync for FacetError
impl Unpin for FacetError
impl UnsafeUnpin for FacetError
impl UnwindSafe for FacetError
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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