Skip to main content

ErrorCode

Trait ErrorCode 

Source
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)] with identity = "biz.xxx" and rely on stable_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 / ExposurePolicy rather than from error_code().

Provided Methods§

Source

fn error_code(&self) -> i32

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§