pub fn for_server_code(code: &str) -> u8Expand description
Returns the exit code for a server error code from the API contract.
ยงExamples
use stratum_node_cli::exit;
assert_eq!(exit::for_server_code("conflict"), exit::CONFLICT);
assert_eq!(exit::for_server_code("request_timeout"), exit::REQUEST_TIMEOUT);
assert_eq!(exit::for_server_code("capacity_exhausted"), exit::CAPACITY_EXHAUSTED);
assert_eq!(exit::for_server_code("suspended"), exit::SUSPENDED);
assert_eq!(exit::for_server_code("pod_unavailable"), exit::POD_UNAVAILABLE);
assert_eq!(exit::for_server_code("image_has_volumes"), exit::IMAGE_REFUSED);
assert_eq!(exit::for_server_code("runner_unavailable"), exit::RUNNER_UNAVAILABLE);
assert_eq!(exit::for_server_code("signer_unavailable"), exit::SIGNER_UNAVAILABLE);
assert_eq!(exit::for_server_code("something_new"), exit::UNKNOWN_SERVER_ERROR);
// `lease_expired` is the pod proxy's answer to a job; no person meets it.
assert_eq!(exit::for_server_code("lease_expired"), exit::UNKNOWN_SERVER_ERROR);