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
impl ErrorDescriptor
Sourcepub const fn class(&self) -> ErrorClass
pub const fn class(&self) -> ErrorClass
Returns the broad catalog-owned class.
Sourcepub const fn condition(&self) -> CanonicalCondition
pub const fn condition(&self) -> CanonicalCondition
Returns the protocol-independent canonical condition.
Sourcepub const fn fault(&self) -> FaultAttribution
pub const fn fault(&self) -> FaultAttribution
Returns the catalog-owned fault attribution.
Sourcepub const fn component(&self) -> ComponentId
pub const fn component(&self) -> ComponentId
Returns the catalog component that owns this descriptor.
Sourcepub const fn public_message(&self) -> &'static str
pub const fn public_message(&self) -> &'static str
Returns the fixed, boundary-safe public message.
Sourcepub const fn severity(&self) -> ErrorSeverity
pub const fn severity(&self) -> ErrorSeverity
Returns the operational severity.
Sourcepub const fn recovery_hint(&self) -> RecoveryHint
pub const fn recovery_hint(&self) -> RecoveryHint
Returns the catalog-owned recovery advice.
Sourcepub const fn backtrace_policy(&self) -> BacktracePolicy
pub const fn backtrace_policy(&self) -> BacktracePolicy
Returns the catalog-controlled backtrace policy.
Sourcepub const fn projection(&self) -> ProjectionSpec
pub const fn projection(&self) -> ProjectionSpec
Returns the explicit boundary projections.
Sourcepub const fn fields(&self) -> &'static [FieldSchema]
pub const fn fields(&self) -> &'static [FieldSchema]
Returns allowed context schemas in catalog declaration order.