"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-08 19:00:20.601529
"""

```python
class FallbackExecutor:
    """
    A class to handle a task execution with fallback options in case of errors.

    Args:
        primary_func: The main function that should be executed.
        fallback_funcs: A list of functions to use as fallbacks if the primary function fails.
        error_types: Optional; A tuple of exception types for which recovery actions are taken. Default is (Exception,).

    Methods:
        execute_task: Attempts to run the primary function and handles errors by using fallback options.
    """

    def __init__(self, primary_func, fallback_funcs, error_types=(Exception,)):
        self.primary_func = primary_func
        self.fallback_funcs = fallback_funcs
        self.error_types = error_types

    def execute_task(self, *args, **kwargs):
        """
        Executes the task using either the primary function or a fallback.

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

        Returns:
            The result of the successful execution, which can be from the primary_func or any fallback_funcs.

        Raises:
            The last encountered exception if no fallback was available or all failed.
        """
        for func in [self.primary_func] + self.fallback_funcs:
            try:
                return func(*args, **kwargs)
            except self.error_types as e:
                print(f"Error occurred: {e}")
                continue
        raise RuntimeError("All functions failed and no successful result was returned.")

# Example usage

def primary_function(x):
    """A simple function that may fail."""
    if x == 0:
        raise ValueError("Input is zero, cannot divide")
    return 1 / x

def fallback_function_1(x):
    """Fallback function for division by non-zero values."""
    return 2 * x

def fallback_function_2(x):
    """Another fallback function for handling errors."""
    return 3 * x

# Create a FallbackExecutor instance
executor = FallbackExecutor(primary_func=primary_function,
                            fallback_funcs=[fallback_function_1, fallback_function_2])

# Execute the task
result = executor.execute_task(0)  # This will fail and try fallbacks
print(result)

result = executor.execute_task(5)  # This should succeed with the primary function
print(result)
```