"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 08:00:22.029941
"""

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


class FallbackExecutor:
    """
    A class for executing functions with fallback mechanisms in case of errors.
    
    Args:
        primary_func: The main function to execute.
        fallback_func: An optional secondary function to be executed if the primary fails.
        error_types: Tuple of exception types that should trigger the fallback.
    
    Methods:
        execute: Executes the primary function and handles errors by falling back to another function.
    """
    
    def __init__(self, 
                 primary_func: Callable[..., Any], 
                 fallback_func: Optional[Callable[..., Any]] = None,
                 error_types: tuple[type[BaseException], ...] = (Exception,)):
        self.primary_func = primary_func
        self.fallback_func = fallback_func
        self.error_types = error_types

    def execute(self) -> Any:
        """
        Executes the primary function and handles errors by falling back to another function.
        
        Returns:
            The result of the successful execution or None if both functions fail.
            
        Raises:
            The last caught exception if neither function succeeds.
        """
        try:
            return self.primary_func()
        except self.error_types as e:
            if self.fallback_func is not None:
                try:
                    return self.fallback_func()
                except self.error_types as e2:
                    raise e2
            else:
                raise e


# Example usage:

def main() -> None:
    """
    Demonstrates the use of FallbackExecutor with a function that may fail.
    """
    
    def risky_operation():
        """Simulates a risky operation."""
        import random
        if random.random() < 0.5:  # 50% chance to fail
            raise ValueError("Oops, something went wrong!")
        return "Operation successful!"
    
    def safer_operation():
        """A safer alternative operation in case of failure."""
        return "Safer operation executed."
    
    executor = FallbackExecutor(risky_operation, fallback_func=safer_operation)
    
    try:
        result = executor.execute()
        print(f"Result: {result}")
    except Exception as e:
        print(f"An error occurred: {e}")


if __name__ == "__main__":
    main()
```