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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//! Bespoke Unix exit codes per error code.
//!
//! Most aube errors exit with the generic [`EXIT_GENERIC`] (`1`). A
//! curated subset — the ones a CI script or shell pipeline most often
//! wants to branch on — gets its own exit code so callers can react
//! without parsing stderr.
//!
//! Exit codes are declared inline on each [`crate::CodeMeta`] entry
//! in [`crate::errors::ALL`]; this module just provides the lookup.
//!
//! The 8-bit exit-code space is lean (POSIX reserves several values
//! 126–165 for shell signals), so codes are allocated in 10-wide
//! ranges by category, with room to grow:
//!
//! | range | category |
//! | ------ | ---------------------------------------------- |
//! | 1 | generic / unknown error |
//! | 2 | CLI usage error |
//! | 10–19 | lockfile |
//! | 20–29 | resolver |
//! | 30–39 | tarball / store |
//! | 40–49 | registry / network |
//! | 50–59 | scripts / build |
//! | 60–69 | linker |
//! | 70–79 | manifest / workspace |
//! | 80–89 | engine / cli surface |
//! | 90–99 | misc / safety |
//!
//! Tooling consumers should branch on the *exit code* rather than the
//! exit category, since the categories are documentation, not API.
use crateerrors;
/// Generic catch-all. Anything not explicitly assigned an exit code
/// in [`crate::errors::ALL`] resolves to this exit code.
pub const EXIT_GENERIC: i32 = 1;
/// CLI usage error — bad flags, conflicting options, missing required
/// arguments. Reserved as a convention, not currently emitted by aube
/// itself (clap exits with this code on its own).
pub const EXIT_CLI_USAGE: i32 = 2;
/// Returns the bespoke exit code for `code`, or `None` if the code
/// has no bespoke entry (the caller should use [`EXIT_GENERIC`]).
///
/// Linear-scan lookup over [`crate::errors::ALL`]. Fine for ~50
/// entries and avoids dragging in a HashMap. The failure path is not
/// hot.