"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 22:46:59.652978
"""

```python
from typing import Any


class FallbackExecutor:
    """
    A class designed to execute tasks with fallback mechanisms in case of errors.

    Attributes:
        default_value: The default value returned when an error occurs.
        fallback_functions: A list of function objects that will be tried as a fallback if the main execution fails.

    Methods:
        execute_task(task_func: callable, *args, **kwargs) -> Any:
            Executes the given task function. If it raises an exception, tries to use fallback functions.
    """

    def __init__(self, default_value: Any = None):
        self.default_value = default_value
        self.fallback_functions: list[callable] = []

    def add_fallback(self, func: callable) -> None:
        """
        Adds a function as a fallback.

        Args:
            func (callable): The function to be added as a fallback. It should accept the same arguments as the main task.
        """
        self.fallback_functions.append(func)

    def execute_task(self, task_func: callable, *args, **kwargs) -> Any:
        """
        Executes the given task function with error recovery.

        Args:
            task_func (callable): The main task function to be executed. It should accept the same arguments as the fallback functions.
            *args: Positional arguments for the task function and fallbacks.
            **kwargs: Keyword arguments for the task function and fallbacks.

        Returns:
            Any: The result of the successful execution or default_value if all attempts fail.
        """
        try:
            return task_func(*args, **kwargs)
        except Exception as e:
            print(f"Error occurred in main task: {e}")
            for fallback in self.fallback_functions:
                try:
                    result = fallback(*args, **kwargs)
                    print("Using fallback function.")
                    return result
                except Exception as fe:
                    print(f"Fallback error: {fe}")
            return self.default_value


# Example usage

def main_task(a: int, b: int) -> int:
    """
    A sample task that may fail if the inputs are not positive integers.
    """
    if a <= 0 or b <= 0:
        raise ValueError("Inputs must be positive integers.")
    return a + b


def fallback1(a: int, b: int) -> int:
    print("Fallback 1 executed")
    return a * b

def fallback2(a: int, b: int) -> int:
    print("Fallback 2 executed")
    return abs(a - b)


executor = FallbackExecutor(default_value=0)
executor.add_fallback(fallback1)
executor.add_fallback(fallback2)

result = executor.execute_task(main_task, -5, 3)
print(f"Result: {result}")
```