pub trait ErrorCode {
// Provided method
fn error_code(&self) -> i32 { ... }
}Expand description
Legacy numeric error code.
The authoritative machine identity is
ErrorIdentityProvider::stable_code + ErrorIdentityProvider::error_category.
The numeric error_code() is retained only for backward compatibility with
older numeric-code integrations (HTTP status mapping, legacy dashboards) and
for the built-in crate::UnifiedReason helpers.
§Migration guidance
- Prefer
#[derive(OrionError)]withidentity = "biz.xxx"and rely onstable_code()for stable, machine-facing identity. - Do not introduce new numeric-code semantics on top of
error_code(); the default (500) is a compatibility fallback, not a classification. - If you must expose a numeric value (e.g. for an HTTP status), derive it from
ErrorCategory/ExposurePolicyrather than fromerror_code().
Provided Methods§
fn error_code(&self) -> i32
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".