Skip to main content

eggress_pproxy_compat/
exit_codes.rs

1pub const EXIT_SUCCESS: i32 = 0;
2pub const EXIT_RUNTIME_FAILURE: i32 = 1;
3pub const EXIT_CLI_PARSE_ERROR: i32 = 2;
4pub const EXIT_CONFIG_VALIDATION: i32 = 3;
5pub const EXIT_BIND_FAILURE: i32 = 4;
6pub const EXIT_UNSUPPORTED_FEATURE: i32 = 5;
7pub const EXIT_PLATFORM_MISSING: i32 = 6;
8pub const EXIT_EXTERNAL_DEPENDENCY: i32 = 7;
9pub const EXIT_SIGINT: i32 = 130;
10pub const EXIT_SIGTERM: i32 = 143;
11
12pub fn exit_code_name(code: i32) -> &'static str {
13    match code {
14        EXIT_SUCCESS => "success",
15        EXIT_RUNTIME_FAILURE => "runtime_failure",
16        EXIT_CLI_PARSE_ERROR => "cli_parse_error",
17        EXIT_CONFIG_VALIDATION => "config_validation",
18        EXIT_BIND_FAILURE => "bind_failure",
19        EXIT_UNSUPPORTED_FEATURE => "unsupported_feature",
20        EXIT_PLATFORM_MISSING => "platform_missing",
21        EXIT_EXTERNAL_DEPENDENCY => "external_dependency",
22        EXIT_SIGINT => "interrupted_by_sigint",
23        EXIT_SIGTERM => "terminated_by_sigterm",
24        _ => "unknown",
25    }
26}