pub struct StructError<T: DomainReason> { /* private fields */ }Expand description
Structured runtime error carrier with explicit bridge APIs for the standard error ecosystem.
use orion_error::{StructError, UvsReason};
let err = StructError::from(UvsReason::system_error());
let _ = std::error::Error::source(&err);use orion_error::{StructError, UvsReason};
let err = StructError::from(UvsReason::system_error());
let bridged = err.as_std();
let _ = std::error::Error::source(&bridged);Implementations§
Source§impl<T: DomainReason> StructError<T>
impl<T: DomainReason> StructError<T>
Source§impl<T: DomainReason> StructError<T>
impl<T: DomainReason> StructError<T>
Source§impl<T: DomainReason> StructError<T>
impl<T: DomainReason> StructError<T>
Sourcepub fn attach_source<S>(self, source: S) -> Selfwhere
S: IntoSourcePayload,
pub fn attach_source<S>(self, source: S) -> Selfwhere
S: IntoSourcePayload,
Attach any source that can be converted into the dual-channel source payload model.
Ordinary StdError values attach as SourcePayloadKind::Std, while
StructError<_> attaches as SourcePayloadKind::Struct.
Sourcepub fn with_std_source<E>(self, source: E) -> Self
pub fn with_std_source<E>(self, source: E) -> Self
Attach a non-structured source error.
For StructError<_> sources, use with_struct_source(...) so metadata and
structured source frames are preserved.
Sourcepub fn with_source<S>(self, source: S) -> Selfwhere
S: IntoSourcePayload,
pub fn with_source<S>(self, source: S) -> Selfwhere
S: IntoSourcePayload,
Recommended helper that auto-routes either a standard source error or an
existing StructError<_> through the dual-channel source model.
Use with_std_source(...) / with_struct_source(...) instead when the
call site should make the source kind explicit.
pub fn with_struct_source<R>(self, source: StructError<R>) -> Self
pub fn source_ref(&self) -> Option<&(dyn StdError + 'static)>
pub fn root_cause(&self) -> Option<&(dyn StdError + 'static)>
pub fn source_frames(&self) -> &[SourceFrame]
pub fn source_payload(&self) -> Option<SourcePayloadRef<'_>>
pub fn source_payload_kind(&self) -> Option<SourcePayloadKind>
pub fn root_cause_frame(&self) -> Option<&SourceFrame>
pub fn context_metadata(&self) -> ErrorMetadata
pub fn source_chain(&self) -> Vec<String>
pub fn into_std(self) -> OwnedStdStructError<T>
pub fn into_boxed_std(self) -> Box<dyn StdError + Send + Sync + 'static>
pub fn into_dyn_std(self) -> OwnedDynStdStructError
pub fn as_std(&self) -> StdStructRef<'_, T>
pub fn display_chain(&self) -> String
pub fn render(&self, mode: RenderMode) -> String
pub fn render_redacted( &self, mode: RenderMode, policy: &impl RedactPolicy, ) -> String
Source§impl<T: DomainReason> StructError<T>
impl<T: DomainReason> StructError<T>
pub fn builder(reason: T) -> StructErrorBuilder<T>
Sourcepub fn with_position(self, position: impl Into<String>) -> Self
pub fn with_position(self, position: impl Into<String>) -> Self
使用示例 self.with_position(location!());
pub fn with_context<C: Into<OperationContext>>(self, context: C) -> Self
pub fn contexts(&self) -> &[OperationContext]
pub fn with_detail(self, detail: impl Into<String>) -> Self
pub fn err<V>(self) -> Result<V, Self>
pub fn target_main(&self) -> Option<String>
pub fn action_main(&self) -> Option<String>
pub fn locator_main(&self) -> Option<String>
Sourcepub fn target(&self) -> Option<String>
pub fn target(&self) -> Option<String>
Compatibility alias for target_main().
Prefer target_main() in new code when pairing it with target_path().
pub fn path_segments(&self) -> Vec<String>
pub fn target_path(&self) -> Option<String>
Source§impl<T: DomainReason> StructError<T>
impl<T: DomainReason> StructError<T>
pub fn report(&self) -> DiagnosticReport
pub fn into_report(self) -> DiagnosticReport
pub fn report_redacted(&self, policy: &impl RedactPolicy) -> DiagnosticReport
Source§impl<T> StructError<T>where
T: DomainReason + ErrorIdentityProvider,
impl<T> StructError<T>where
T: DomainReason + ErrorIdentityProvider,
pub fn exposure_view(&self) -> ExposureView
pub fn into_exposure_view(self) -> ExposureView
pub fn exposure_snapshot( &self, exposure_policy: &impl ExposurePolicy, ) -> ErrorProtocolSnapshot
pub fn into_exposure_snapshot( self, exposure_policy: &impl ExposurePolicy, ) -> ErrorProtocolSnapshot
pub fn http_response( &self, exposure_policy: &impl ExposurePolicy, ) -> ErrorHttpResponse
pub fn cli_response( &self, exposure_policy: &impl ExposurePolicy, ) -> ErrorCliResponse
pub fn log_response( &self, exposure_policy: &impl ExposurePolicy, ) -> ErrorLogResponse
pub fn rpc_response( &self, exposure_policy: &impl ExposurePolicy, ) -> ErrorRpcResponse
pub fn render_user_debug(&self, exposure_policy: &impl ExposurePolicy) -> String
pub fn render_user_debug_redacted( &self, exposure_policy: &impl ExposurePolicy, redact_policy: &impl RedactPolicy, ) -> String
pub fn render_debug_summary( &self, exposure_policy: &impl ExposurePolicy, ) -> String
Source§impl<T: DomainReason> StructError<T>
impl<T: DomainReason> StructError<T>
pub fn snapshot(&self) -> ErrorSnapshot
pub fn into_snapshot(self) -> ErrorSnapshot
Source§impl<T> StructError<T>where
T: DomainReason + ErrorIdentityProvider,
impl<T> StructError<T>where
T: DomainReason + ErrorIdentityProvider,
pub fn identity_snapshot(&self) -> ErrorIdentity
Trait Implementations§
Source§impl<T: Clone + DomainReason> Clone for StructError<T>
impl<T: Clone + DomainReason> Clone for StructError<T>
Source§fn clone(&self) -> StructError<T>
fn clone(&self) -> StructError<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<R1, R2> ConvStructError<R2> for StructError<R1>where
R1: DomainReason,
R2: DomainReason + From<R1>,
impl<R1, R2> ConvStructError<R2> for StructError<R1>where
R1: DomainReason,
R2: DomainReason + From<R1>,
fn conv(self) -> StructError<R2>
Source§impl<T: Debug + DomainReason> Debug for StructError<T>
impl<T: Debug + DomainReason> Debug for StructError<T>
Source§impl<T: DomainReason> Deref for StructError<T>
impl<T: DomainReason> Deref for StructError<T>
Source§impl<T: DomainReason + ErrorCode> ErrorCode for StructError<T>
impl<T: DomainReason + ErrorCode> ErrorCode for StructError<T>
fn error_code(&self) -> i32
Source§impl<T> ErrorIdentityProvider for StructError<T>where
T: DomainReason + ErrorIdentityProvider,
impl<T> ErrorIdentityProvider for StructError<T>where
T: DomainReason + ErrorIdentityProvider,
fn stable_code(&self) -> &'static str
fn error_category(&self) -> ErrorCategory
Source§impl<T: DomainReason> ErrorWith for StructError<T>
impl<T: DomainReason> ErrorWith for StructError<T>
Source§fn want<S: Into<String>>(self, desc: S) -> Self
fn want<S: Into<String>>(self, desc: S) -> Self
use doing(…) for action contexts; use at(…) for locator/resource contexts
fn position<S: Into<String>>(self, pos: S) -> Self
fn with_context<C: Into<OperationContext>>(self, ctx: C) -> Self
Source§fn attach_context<C: Into<OperationContext>>(self, ctx: C) -> Selfwhere
Self: Sized,
fn attach_context<C: Into<OperationContext>>(self, ctx: C) -> Selfwhere
Self: Sized,
use with_context(…) for full context frames; use doing(…) / at(…) for semantic context helpers
Source§fn with<C: Into<OperationContext>>(self, ctx: C) -> Selfwhere
Self: Sized,
fn with<C: Into<OperationContext>>(self, ctx: C) -> Selfwhere
Self: Sized,
use with_context(…) for full context frames; use at(…) / doing(…) for semantic context helpers