Function get_error_str

Source
pub fn get_error_str(error_code: c_int) -> &'static str
Expand description

Returns a human-readable error message based on the provided error code.

This function acts as a wrapper around the get_error_message function, providing a simpler interface for retrieving error messages.

§Arguments

  • error_code: An integer (c_int) representing the error code.

§Returns

A static string slice (&'static str) containing a human-readable description of the error.

§Supported Error Codes

  • 0 (SUCCESS): “Success”
  • 1 (DIVISION_BY_ZERO): “Division by zero”
  • 2 (INVALID_OPERATOR): “Invalid operator”
  • 3 (STACK_UNDERFLOW): “Stack underflow - invalid expression”
  • 4 (MEMORY_ERROR): “Memory error”
  • 5 (UNDEFINED_VARIABLE): “Undefined variable in expression”
  • 6 (STACK_MAXIMUM): “Stack maximum exceeded”
  • 7 (EXPR_LENGHT_MAXIMUM): “Expression length maximum exceeded”
  • 8 (FACTORIAL_ERROR): “Factorial error”
  • 9 (SQUARE_ROOT_ERROR): “Square root error”
  • 10 (LOG_ERROR): “Log error”
  • 11 (LN_ERROR): “Natural logarithm error”
  • Any other value: “Unknown error”