map_error_to_exit_code

Function map_error_to_exit_code 

Source
pub fn map_error_to_exit_code(error_message: &str) -> ExitCode
Expand description

Maps application error messages to Unix exit codes (sysexits.h standard)

This function analyzes error messages and maps them to appropriate exit codes. It’s designed to work with the pipeline’s error messages.

§Exit Code Mappings

  • 70 (EX_SOFTWARE) - Internal software error (initialization failures)
  • 66 (EX_NOINPUT) - Cannot open input (file not found)
  • 65 (EX_DATAERR) - Data format error (invalid input)
  • 74 (EX_IOERR) - Input/output error (read/write failures)
  • 1 - General error (fallback for unclassified errors)

§Arguments

  • error_message - The error message to classify

§Returns

The appropriate ExitCode variant

§Example

use adaptive_pipeline_bootstrap::exit_code::map_error_to_exit_code;

let code = map_error_to_exit_code("Failed to initialize resource manager");
assert_eq!(code.as_i32(), 70); // EX_SOFTWARE