"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 17:19:20.923849
"""

```python
from typing import Callable, Any


class FallbackExecutor:
    """
    A class for executing a task with fallback error handling.
    
    Args:
        primary_func: The primary function to execute.
        fallback_func: The fallback function to use if the primary function fails.
        
    Raises:
        Exception: If both `primary_func` and `fallback_func` raise errors.
    """

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

    def execute_with_fallback(self) -> Any:
        """
        Execute the `primary_func`. If it raises an error, execute `fallback_func`.
        
        Returns:
            The result of either the `primary_func` or `fallback_func`, depending on success.
            
        Raises:
            Exception: If both functions raise errors simultaneously.
        """
        try:
            return self.primary_func()
        except Exception as primary_exception:
            try:
                return self.fallback_func()
            except Exception as fallback_exception:
                raise Exception("Both primary and fallback functions failed.") from fallback_exception


# Example usage
def primary_task() -> str:
    """A primary task that could fail due to an error."""
    # Simulate a failure with an exception, for example.
    1 / 0  # Zero division error
    return "Task completed successfully!"


def fallback_task() -> str:
    """A fallback task that executes if the primary task fails."""
    return "Executing fallback task as the primary one failed!"


# Creating instances of FallbackExecutor and using it to handle potential errors.
executor = FallbackExecutor(primary_task, fallback_task)

try:
    result = executor.execute_with_fallback()
    print(result)
except Exception as e:
    print(f"An error occurred: {e}")
```