"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 00:33:14.587597
"""

```python
from typing import Any, Callable, Optional


class FallbackExecutor:
    """
    A class for executing a function with fallbacks in case of errors.
    
    This is useful when you want to provide robust error recovery in your application,
    ensuring that if the primary execution fails, a secondary or tertiary action can be taken.

    :param func: The main function to execute
    :param fallback_func: A function to use as a fallback in case `func` raises an exception.
    """

    def __init__(self, func: Callable[..., Any], fallback_func: Optional[Callable[..., Any]] = None):
        self.func = func
        self.fallback_func = fallback_func

    def execute(self, *args: Any, **kwargs: Any) -> Any:
        """
        Execute the main function with an optional fallback.
        
        :param args: Positional arguments to pass to `func`.
        :param kwargs: Keyword arguments to pass to `func`.
        :return: The result of executing `func` or `fallback_func`, if applicable.
        """
        try:
            return self.func(*args, **kwargs)
        except Exception as e:
            if self.fallback_func is not None:
                print(f"Main function failed with exception: {e}")
                return self.fallback_func(*args, **kwargs)
            else:
                raise

# Example usage
def main_function(x):
    """
    An example function that may fail.
    
    :param x: A value to process.
    """
    if x <= 0:
        raise ValueError("x must be positive")
    return x * 10

def fallback_function(x):
    """
    A simple fallback function in case of failure.
    
    :param x: A value to process.
    """
    print(f"Falling back with x={x}")
    return x + 10

# Create an instance of FallbackExecutor
executor = FallbackExecutor(main_function, fallback_func=fallback_function)

# Test the executor with valid and invalid inputs
result_valid_input = executor.execute(5)
print(result_valid_input)  # Expected: 50

result_invalid_input = executor.execute(-1)
print(result_invalid_input)  # Expected: "Falling back with x=-1" followed by 10, as a fallback result.
```