Skip to main content

ErrorDescriptor

Struct ErrorDescriptor 

Source
pub struct ErrorDescriptor { /* private fields */ }
Expand description

Immutable catalog metadata for one canonical error identity.

A descriptor owns stable identity, classification, fault attribution, component ownership, the fixed public message, operational policy, public exposure, backtrace capture, and explicit boundary projections. Its ordered field schemas define the only context accepted by descriptor-aware views. Catalog consumers can inspect this metadata but cannot construct or modify descriptors outside this crate.

ⓘ
use rocketmq_error::{
    BacktracePolicy, CanonicalCondition, ComponentId, ErrorClass, ErrorCode,
    ErrorDescriptor, ErrorSeverity, Exposure, FaultAttribution, RecoveryHint,
};

let descriptor = ErrorDescriptor {
    code: ErrorCode::try_new("example.operation.failed").unwrap(),
    class: ErrorClass::INTERNAL,
    condition: CanonicalCondition::Internal,
    fault: FaultAttribution::Unknown,
    component: ComponentId::CORE,
    public_message: "The operation failed",
    severity: ErrorSeverity::Error,
    recovery_hint: RecoveryHint::OperatorAction,
    backtrace: BacktracePolicy::OnDemand,
    exposure: Exposure::Generic,
    projection: todo!(),
    fields: &[],
};

Implementations§

Source§

impl ErrorDescriptor

Source

pub const fn code(&self) -> ErrorCode

Returns the stable dotted catalog code.

Source

pub const fn class(&self) -> ErrorClass

Returns the broad catalog-owned class.

Source

pub const fn condition(&self) -> CanonicalCondition

Returns the protocol-independent canonical condition.

Source

pub const fn fault(&self) -> FaultAttribution

Returns the catalog-owned fault attribution.

Source

pub const fn component(&self) -> ComponentId

Returns the catalog component that owns this descriptor.

Source

pub const fn public_message(&self) -> &'static str

Returns the fixed, boundary-safe public message.

Source

pub const fn severity(&self) -> ErrorSeverity

Returns the operational severity.

Source

pub const fn recovery_hint(&self) -> RecoveryHint

Returns the catalog-owned recovery advice.

Source

pub const fn backtrace_policy(&self) -> BacktracePolicy

Returns the catalog-controlled backtrace policy.

Source

pub const fn exposure(&self) -> Exposure

Returns the public-context exposure policy.

Source

pub const fn projection(&self) -> ProjectionSpec

Returns the explicit boundary projections.

Source

pub const fn fields(&self) -> &'static [FieldSchema]

Returns allowed context schemas in catalog declaration order.

Trait Implementations§

Source§

impl Clone for ErrorDescriptor

Source§

fn clone(&self) -> Self

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 Copy for ErrorDescriptor

Source§

impl Debug for ErrorDescriptor

Source§

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

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

impl Eq for ErrorDescriptor

Source§

impl PartialEq for ErrorDescriptor

Source§

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

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, 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> 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 = !

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.