1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/// 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()`.
/// Categorisation of an error for protocol-level routing and policy decisions.
/// Runtime identity provider for stable error codes and categories.
///
/// Implemented automatically by `#[derive(OrionError)]`. Used by
/// [`StructError::exposure`](crate::StructError::exposure)
/// and the protocol projection layer to determine visibility and
/// exposure decisions.