Struct PublicError
pub struct PublicError { /* private fields */ }Expand description
A failure safe to display, serialize, or map at a public transport boundary.
This type cannot carry arbitrary messages or an error source. Construction is restricted to named constructors so its kind and details cannot disagree. The optional incident identifier is an opaque correlation value, not a diagnostic.
Implementations§
§impl PublicError
impl PublicError
pub const fn validation(issues: ValidationIssues) -> PublicError
pub const fn validation(issues: ValidationIssues) -> PublicError
Creates a bounded validation failure.
pub const fn idempotency_key_reuse() -> PublicError
pub const fn idempotency_key_reuse() -> PublicError
Creates an idempotency-key-reuse failure.
Creates an authorization-denied failure.
pub const fn concurrency_deadline_exceeded() -> PublicError
pub const fn concurrency_deadline_exceeded() -> PublicError
Creates the shared failure for a logical-conflict deadline or exhausted fixed v1 command reevaluation budget.
pub const fn contract_mismatch(
active_contract_version: ContractVersion,
) -> PublicError
pub const fn contract_mismatch( active_contract_version: ContractVersion, ) -> PublicError
Creates a contract mismatch and identifies the active version.
Creates a storage-unavailable failure.
pub const fn outcome_unknown() -> PublicError
pub const fn outcome_unknown() -> PublicError
Creates an uncertain-outcome failure.
pub const fn command_execution_failed(code: ExecutionFailureCode) -> PublicError
pub const fn command_execution_failed(code: ExecutionFailureCode) -> PublicError
Creates a deterministic command-execution failure.
pub const fn internal_defect(incident_id: IncidentId) -> PublicError
pub const fn internal_defect(incident_id: IncidentId) -> PublicError
Creates a redacted internal-defect failure with its incident identifier.
pub const fn history_incarnation_mismatch() -> PublicError
pub const fn history_incarnation_mismatch() -> PublicError
Creates a history-incarnation mismatch failure.
pub const fn history_pruned() -> PublicError
pub const fn history_pruned() -> PublicError
Creates a history-pruned failure (RDB-HISTORY-0102).
pub const fn follower_mode() -> PublicError
pub const fn follower_mode() -> PublicError
Creates the typed follower-mode refusal before any write is admitted.
pub const fn primary_fenced() -> PublicError
pub const fn primary_fenced() -> PublicError
Creates the durable primary-fence refusal before command admission. This outcome never recommends retrying or clearing the fence.
pub const fn overloaded() -> PublicError
pub const fn overloaded() -> PublicError
Creates an overload / capacity rejection failure.
pub const fn with_incident_id(self, incident_id: IncidentId) -> PublicError
pub const fn with_incident_id(self, incident_id: IncidentId) -> PublicError
Adds an opaque incident identifier for trusted diagnostic correlation.
pub fn with_application_code_hint(
self,
code: ApplicationErrorCode,
) -> Result<PublicError, ApplicationErrorHintError>
pub fn with_application_code_hint( self, code: ApplicationErrorCode, ) -> Result<PublicError, ApplicationErrorHintError>
Attaches a stricter symbolic classification for the application surface.
The compatible kernel serializer deliberately ignores this hint.
pub const fn application_code_hint(&self) -> Option<ApplicationErrorCode>
pub const fn application_code_hint(&self) -> Option<ApplicationErrorCode>
Returns the stricter application-only classification, when present.
pub const fn kind(&self) -> PublicErrorKind
pub const fn kind(&self) -> PublicErrorKind
Returns the closed failure kind.
pub const fn safe_message(&self) -> &'static str
pub const fn safe_message(&self) -> &'static str
Returns the stable public-safe message.
pub const fn class(&self) -> ErrorClass
pub const fn class(&self) -> ErrorClass
Returns the protocol-neutral failure class.
pub const fn status_code(&self) -> PublicErrorStatusCode
pub const fn status_code(&self) -> PublicErrorStatusCode
Returns the authoritative public status code for this error.
pub const fn recovery_action(&self) -> RecoveryAction
pub const fn recovery_action(&self) -> RecoveryAction
Returns safe recovery guidance.
pub const fn details(&self) -> &PublicErrorDetails
pub const fn details(&self) -> &PublicErrorDetails
Returns structured, caller-safe detail for this failure.
pub const fn incident_id(&self) -> Option<&IncidentId>
pub const fn incident_id(&self) -> Option<&IncidentId>
Returns the opaque incident identifier, when one is available.
Trait Implementations§
§impl Clone for PublicError
impl Clone for PublicError
§fn clone(&self) -> PublicError
fn clone(&self) -> PublicError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PublicError
impl Debug for PublicError
§impl Display for PublicError
impl Display for PublicError
impl Eq for PublicError
§impl Error for PublicError
impl Error for PublicError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
§impl From<InternalError> for PublicError
impl From<InternalError> for PublicError
§fn from(error: InternalError) -> PublicError
fn from(error: InternalError) -> PublicError
§impl PartialEq for PublicError
impl PartialEq for PublicError
impl StructuralPartialEq for PublicError
Auto Trait Implementations§
impl Freeze for PublicError
impl RefUnwindSafe for PublicError
impl Send for PublicError
impl Sync for PublicError
impl Unpin for PublicError
impl UnsafeUnpin for PublicError
impl UnwindSafe for PublicError
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].