"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 06:55:53.579130
"""

```python
class FallbackExecutor:
    """
    A class that implements a fallback mechanism for executing functions.
    
    This class provides a way to execute a primary function and, in case of failure,
    revert to an alternative function. It is particularly useful when the alternative
    function can handle certain errors that the primary function cannot.

    Args:
        primary_func (Callable): The main function to be executed.
        fallback_func (Callable): The secondary function to be used if the primary fails.
    
    Returns:
        Any: The result of the successful execution, or an error message.
    """

    def __init__(self, primary_func: Callable[[Any], Any], fallback_func: Callable[[Any], Any]):
        self.primary_func = primary_func
        self.fallback_func = fallback_func

    def execute(self, *args, **kwargs) -> Any:
        """
        Execute the primary function with given arguments. If an error occurs,
        attempt to execute the fallback function.
        
        Args:
            *args: Positional arguments passed to both functions.
            **kwargs: Keyword arguments passed to both functions.

        Returns:
            The result of the successful execution or an error message.
        """
        try:
            return self.primary_func(*args, **kwargs)
        except Exception as e:
            print(f"Error occurred in primary function: {e}")
            try:
                return self.fallback_func(*args, **kwargs)
            except Exception as fe:
                return f"Both functions failed with error: {fe}"

# Example usage
def primary_add(a: int, b: int) -> int:
    """Add two numbers and may raise an exception for demonstration."""
    if a < 0 or b < 0:
        raise ValueError("Negative input not allowed")
    return a + b

def fallback_subtract(a: int, b: int) -> int:
    """Subtract the second number from the first as a fallback operation."""
    return a - b

executor = FallbackExecutor(primary_func=primary_add, fallback_func=fallback_subtract)
print(executor.execute(5, 3))  # Should print 8
print(executor.execute(-1, 2))  # Should handle error and use the fallback to print 3
```