Skip to main content

orion_error/
lib.rs

1mod core;
2pub mod testcase;
3mod traits;
4
5extern crate self as orion_error;
6
7#[cfg(feature = "derive")]
8pub use orion_error_derive::{ErrorCode, ErrorIdentityProvider, OrionError};
9
10pub use core::{DefaultExposurePolicy, OperationContext, StructError, UvsReason};
11pub use traits::{ErrorWith, ErrorWrapAs, IntoAs};
12
13#[doc(hidden)]
14pub use core::{
15    DomainReason, ErrorCategory, ErrorCode, ErrorIdentityProvider, ErrorRenderer, RenderMode,
16    TextDiagnosticRenderer, TextReportRenderer, UvsFrom, Visibility,
17};
18#[doc(hidden)]
19pub use traits::ErrorConv;
20
21/// Primary-path traits and types for convenient wildcard imports.
22///
23/// # Example
24/// ```rust,ignore
25/// use orion_error::prelude::*;
26/// ```
27pub mod prelude {
28    pub use crate::core::{DefaultExposurePolicy, StructError};
29    pub use crate::traits::{ErrorWith, ErrorWrapAs, IntoAs};
30    #[cfg(feature = "derive")]
31    pub use crate::OrionError;
32}
33
34/// Wildcard imports for protocol/schema checks and migration-oriented tests.
35///
36/// Prefer [`prelude`] for new application code. Use this module when a test or
37/// verification task intentionally needs broad access to projection, snapshot,
38/// bridge, and conversion surfaces in one place.
39pub mod advanced_prelude {
40    pub use crate::core::{
41        DefaultExposurePolicy, DiagnosticReport, ErrorCategory, ErrorCliResponse, ErrorCode,
42        ErrorHttpResponse, ErrorIdentity, ErrorIdentityProvider, ErrorLogResponse, ErrorMetadata,
43        ErrorProtocolSnapshot, ErrorRenderer, ErrorRpcResponse, ErrorSnapshot, ExposureDecision,
44        ExposurePolicy, ExposureView, IntoSourcePayload, OwnedDynStdStructError,
45        OwnedStdStructError, RedactPolicy, RenderMode, SnapshotContextFrame, SnapshotSourceFrame,
46        SourceFrame, SourcePayload, SourcePayloadKind, SourcePayloadRef, StableErrorSnapshot,
47        StableSnapshotContextFrame, StableSnapshotSourceFrame, StdStructRef, StructError,
48        TextDiagnosticRenderer, UvsFrom, UvsReason, Visibility, STABLE_SNAPSHOT_SCHEMA_VERSION,
49    };
50    pub use crate::traits::{
51        raw_source, ConvStructError, ErrorConv, ErrorWith, ErrorWrapAs, IntoAs, RawSource,
52        RawStdError, ToStructError, WrapStructErrorAs,
53    };
54    #[cfg(feature = "derive")]
55    pub use crate::OrionError;
56}
57
58/// Compatibility wildcard imports for legacy conversion APIs.
59///
60/// Use this only when maintaining older `owe(...)` call paths.
61pub mod compat_prelude {
62    pub use crate::traits::{
63        ErrorOwe, ErrorOweBase, ErrorOweSource, ErrorOweSourceBase, ErrorWrap, WrapStructError,
64    };
65}
66
67/// Shared data carriers and enums that are still convenient outside the
68/// layered namespaces.
69pub mod types {
70    pub use crate::core::{
71        ConfErrReason, DiagnosticReport, ErrStrategy, ErrorCategory, ErrorIdentity,
72        ErrorIdentityProvider, ErrorMetadata, ErrorProtocolSnapshot, ExposureDecision,
73        MetadataValue, OperationContext, OperationScope, StructError, StructErrorBuilder,
74        UvsReason, Visibility, WithContext,
75    };
76}
77
78/// Runtime-layer types.
79///
80/// These are the primary carriers used while an error is still moving through
81/// application code.
82pub mod runtime {
83    pub use crate::core::{
84        ContextRecord, ErrorMetadata, MetadataValue, OperationContext, OperationScope, SourceFrame,
85        SourcePayload, SourcePayloadKind, SourcePayloadRef, StructError, StructErrorBuilder,
86        WithContext,
87    };
88}
89
90/// Explicit bridge types for entering the standard error ecosystem.
91pub mod bridge {
92    pub use crate::core::{
93        IntoSourcePayload, OwnedDynStdStructError, OwnedStdStructError, SourcePayload,
94        SourcePayloadKind, SourcePayloadRef, StdStructRef,
95    };
96    pub use crate::traits::{raw_source, RawSource, RawStdError};
97}
98
99/// Snapshot-layer types and stable snapshot schema exports.
100pub mod snapshot {
101    pub use crate::core::{
102        ErrorIdentity, ErrorSnapshot, SnapshotContextFrame, SnapshotSourceFrame,
103        StableErrorSnapshot, StableSnapshotContextFrame, StableSnapshotSourceFrame,
104        STABLE_SNAPSHOT_SCHEMA_VERSION,
105    };
106}
107
108/// Report-layer types for rendering and redaction.
109pub mod report {
110    pub use crate::core::{
111        DefaultExposurePolicy, DiagnosticReport, ErrorCliResponse, ErrorHttpResponse,
112        ErrorLogResponse, ErrorProtocolSnapshot, ErrorRenderer, ErrorRpcResponse, ExposureDecision,
113        ExposurePolicy, ExposureView, RedactPolicy, RenderMode, TextDiagnosticRenderer, Visibility,
114    };
115}
116
117/// Reason-layer enums and traits.
118pub mod reason {
119    pub use crate::core::{
120        ConfErrReason, ErrorCategory, ErrorCode, ErrorIdentityProvider, UvsFrom, UvsReason,
121    };
122}
123
124/// Conversion traits for the current primary paths.
125pub mod conversion {
126    pub use crate::traits::{
127        ErrorConv, ErrorWith, ErrorWrapAs, IntoAs, ToStructError, WrapStructErrorAs,
128    };
129}
130
131/// Advanced conversion helpers that are not part of the default import path.
132pub mod conversion_ext {
133    pub use crate::traits::ConvStructError;
134}
135
136/// Grouped conversion and context extension traits.
137pub mod traits_ext {
138    pub use crate::runtime::ContextRecord;
139    pub use crate::traits::{
140        ConvStructError, ErrorConv, ErrorWith, ErrorWrapAs, IntoAs, ToStructError,
141        WrapStructErrorAs,
142    };
143    pub use crate::{ErrorCode, UvsFrom};
144}
145
146/// Compatibility trait exports for legacy conversion helpers.
147pub mod compat_traits {
148    pub use crate::traits::{
149        ErrorOwe, ErrorOweBase, ErrorOweSource, ErrorOweSourceBase, ErrorWrap, WrapStructError,
150    };
151}