"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 07:53:31.620547
"""

```python
from typing import Any, Callable


class FallbackExecutor:
    """
    A class for handling functions that may fail and providing a fallback mechanism.

    Attributes:
        primary_function (Callable): The main function to execute.
        fallback_function (Callable): The function to use if the primary function fails.
    """

    def __init__(self, primary_function: Callable[..., Any], fallback_function: Callable[..., Any]):
        """
        Initialize the FallbackExecutor with a primary and a fallback function.

        Args:
            primary_function (Callable): The main function to execute.
            fallback_function (Callable): The function to use if the primary function fails.
        """
        self.primary_function = primary_function
        self.fallback_function = fallback_function

    def execute_with_fallback(self, *args: Any, **kwargs: Any) -> Any:
        """
        Execute the primary function. If an exception is raised, call the fallback function.

        Args:
            *args: Positional arguments to pass to both functions.
            **kwargs: Keyword arguments to pass to both functions.

        Returns:
            The result of the primary_function if it succeeds, otherwise the result of the fallback_function.
        """
        try:
            return self.primary_function(*args, **kwargs)
        except Exception as e:
            print(f"Error occurred while executing {self.primary_function.__name__}: {e}")
            return self.fallback_function(*args, **kwargs)


def primary_operation(x: int) -> int:
    """A simple operation that may fail."""
    if x < 0:
        raise ValueError("Input must be non-negative.")
    return x * 2


def fallback_operation(x: int) -> int:
    """Fallback operation to use when the primary one fails."""
    print(f"Falling back with input {x}")
    return -x


# Example usage
if __name__ == "__main__":
    executor = FallbackExecutor(primary_operation, fallback_operation)
    result = executor.execute_with_fallback(10)  # Should succeed and return 20
    print(result)

    result = executor.execute_with_fallback(-5)  # Should fail and use the fallback function
    print(result)
```

This code defines a `FallbackExecutor` class that takes two functions: a primary one that is expected to perform a task, and a fallback one to handle errors. The example usage demonstrates how it can be used in practice.