"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 18:21:19.533656
"""

```python
class FallbackExecutor:
    """
    A class for executing a function and providing fallback mechanisms in case of errors.

    Args:
        main_function (Callable): The primary function to execute.
        fallback_functions (List[Callable]): List of functions to be tried as fallbacks if the main function fails.
        error_types (Tuple[type, ...], optional): Tuple of exception types for which the fallback should be triggered. Defaults to all exceptions.

    Attributes:
        main_function (Callable): The primary function to execute.
        fallback_functions (List[Callable]): List of functions to be tried as fallbacks if the main function fails.
        error_types (Tuple[type, ...]): Tuple of exception types for which the fallback should be triggered.
    """

    def __init__(self, main_function: Callable, fallback_functions: List[Callable], error_types: Tuple[type, ...] = (Exception,)):
        self.main_function = main_function
        self.fallback_functions = fallback_functions
        self.error_types = error_types

    def execute(self, *args, **kwargs) -> Any:
        """
        Execute the main function or a fallback if an exception is raised.

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

        Returns:
            The result of the executed function or None in case all fallbacks failed.
        """
        try:
            return self.main_function(*args, **kwargs)
        except self.error_types as e:
            for fallback in self.fallback_functions:
                try:
                    return fallback(*args, **kwargs)
                except self.error_types:
                    pass
        return None


# Example usage

def main_function(x: int) -> str:
    """Main function that might fail."""
    if x < 0:
        raise ValueError("Negative number")
    return f"Result is {x * 2}"


def fallback_function1(x: int) -> str:
    """First fallback function."""
    print("Falling back to first function.")
    return f"Fallback result is {(x + 1) * 3}"


def fallback_function2(x: int) -> str:
    """Second fallback function."""
    print("Failing gracefully, second fallback invoked.")
    return "Fallback result from second function"


# Create an instance of FallbackExecutor
executor = FallbackExecutor(main_function, [fallback_function1, fallback_function2])

# Example calls
print(executor.execute(5))  # Should call main function and return the result

print(executor.execute(-3))  # Should trigger exception in main function, then fallback to first fallback

print(executor.execute(7))  # Should not raise an error or need a fallback
```