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§
Source§impl PublicError
impl PublicError
Sourcepub const fn validation(issues: ValidationIssues) -> Self
pub const fn validation(issues: ValidationIssues) -> Self
Creates a bounded validation failure.
Sourcepub const fn idempotency_key_reuse() -> Self
pub const fn idempotency_key_reuse() -> Self
Creates an idempotency-key-reuse failure.
Creates an authorization-denied failure.
Sourcepub const fn concurrency_deadline_exceeded() -> Self
pub const fn concurrency_deadline_exceeded() -> Self
Creates the shared failure for a logical-conflict deadline or exhausted fixed v1 command reevaluation budget.
Sourcepub const fn contract_mismatch(active_contract_version: ContractVersion) -> Self
pub const fn contract_mismatch(active_contract_version: ContractVersion) -> Self
Creates a contract mismatch and identifies the active version.
Creates a storage-unavailable failure.
Sourcepub const fn outcome_unknown() -> Self
pub const fn outcome_unknown() -> Self
Creates an uncertain-outcome failure.
Sourcepub const fn command_execution_failed(code: ExecutionFailureCode) -> Self
pub const fn command_execution_failed(code: ExecutionFailureCode) -> Self
Creates a deterministic command-execution failure.
Sourcepub const fn internal_defect(incident_id: IncidentId) -> Self
pub const fn internal_defect(incident_id: IncidentId) -> Self
Creates a redacted internal-defect failure with its incident identifier.
Sourcepub const fn history_incarnation_mismatch() -> Self
pub const fn history_incarnation_mismatch() -> Self
Creates a history-incarnation mismatch failure.
Sourcepub const fn history_pruned() -> Self
pub const fn history_pruned() -> Self
Creates a history-pruned failure (RDB-HISTORY-0102).
Sourcepub const fn follower_mode() -> Self
pub const fn follower_mode() -> Self
Creates the typed follower-mode refusal before any write is admitted.
Sourcepub const fn primary_fenced() -> Self
pub const fn primary_fenced() -> Self
Creates the durable primary-fence refusal before command admission. This outcome never recommends retrying or clearing the fence.
Sourcepub const fn overloaded() -> Self
pub const fn overloaded() -> Self
Creates an overload / capacity rejection failure.
Sourcepub const fn with_incident_id(self, incident_id: IncidentId) -> Self
pub const fn with_incident_id(self, incident_id: IncidentId) -> Self
Adds an opaque incident identifier for trusted diagnostic correlation.
Sourcepub fn with_application_code_hint(
self,
code: ApplicationErrorCode,
) -> Result<Self, ApplicationErrorHintError>
pub fn with_application_code_hint( self, code: ApplicationErrorCode, ) -> Result<Self, ApplicationErrorHintError>
Attaches a stricter symbolic classification for the application surface.
The compatible kernel serializer deliberately ignores this hint.
Sourcepub 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.
Sourcepub const fn kind(&self) -> PublicErrorKind
pub const fn kind(&self) -> PublicErrorKind
Returns the closed failure kind.
Sourcepub const fn safe_message(&self) -> &'static str
pub const fn safe_message(&self) -> &'static str
Returns the stable public-safe message.
Sourcepub const fn class(&self) -> ErrorClass
pub const fn class(&self) -> ErrorClass
Returns the protocol-neutral failure class.
Sourcepub const fn status_code(&self) -> PublicErrorStatusCode
pub const fn status_code(&self) -> PublicErrorStatusCode
Returns the authoritative public status code for this error.
Sourcepub const fn recovery_action(&self) -> RecoveryAction
pub const fn recovery_action(&self) -> RecoveryAction
Returns safe recovery guidance.
Sourcepub const fn details(&self) -> &PublicErrorDetails
pub const fn details(&self) -> &PublicErrorDetails
Returns structured, caller-safe detail for this failure.
Sourcepub 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§
Source§impl Clone for PublicError
impl Clone for PublicError
Source§impl Debug for PublicError
impl Debug for PublicError
Source§impl Display for PublicError
impl Display for PublicError
impl Eq for PublicError
Source§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()