pub struct ErrorCode(/* private fields */);Expand description
Stable machine-readable error code.
ErrorCode values are intentionally separate from display messages.
Protocol mapping, retry policy, and observability should use the code, not
formatted error text.
Self::try_new accepts only reviewed catalog identity using the lowercase
dotted grammar. Source display text and runtime values must not become
catalog identity.
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const fn try_new(value: &'static str) -> Option<Self>
pub const fn try_new(value: &'static str) -> Option<Self>
Attempts to create a canonical catalog code.
Canonical codes have at least three dot-separated segments. Every segment starts with a lowercase ASCII letter and continues with lowercase ASCII letters, ASCII digits, or underscores.
Returns None when value does not satisfy that grammar. The
'static input prevents arbitrary runtime strings from becoming catalog
identity; catalog entries must use reviewed static descriptors.