"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-08 10:18:21.022378
"""

```python
from typing import Any, Callable


class FallbackExecutor:
    """
    A class that provides a robust mechanism for executing functions
    while providing fallback mechanisms to recover from errors.
    
    :param primary_fn: The main function to execute.
    :param fallback_fn: An optional secondary function to use if the primary fails.
    """

    def __init__(self, primary_fn: Callable[..., Any], fallback_fn: Callable[..., Any] = None) -> None:
        self.primary_fn = primary_fn
        self.fallback_fn = fallback_fn

    def execute_with_fallback(self, *args: Any, **kwargs: Any) -> Any:
        """
        Executes the main function. If an error occurs during execution,
        attempts to use the fallback function if provided.

        :param args: Arguments to pass to primary and fallback functions.
        :param kwargs: Keyword arguments to pass to primary and fallback functions.
        :return: The result of the executed function or None on failure.
        """
        try:
            return self.primary_fn(*args, **kwargs)
        except Exception as e:
            if self.fallback_fn is not None:
                print(f"Primary function failed with error: {e}")
                return self.fallback_fn(*args, **kwargs)
            else:
                print(f"No fallback function provided. Error: {e}")
                return None


# Example usage
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


def subtract(a: int, b: int) -> int:
    """Subtract second number from first"""
    return a - b


if __name__ == "__main__":
    # Successful execution
    fallback_executor = FallbackExecutor(add)
    print(fallback_executor.execute_with_fallback(5, 3))  # Output: 8

    # Primary function fails, fallback used
    fallback_executor = FallbackExecutor(add, subtract)
    print(fallback_executor.execute_with_fallback(5, 0))  # Output: 5

    # Primary and fallback both fail
    print(fallback_executor.execute_with_fallback(1, 'a'))  # Output: No fallback function provided. Error:
```