"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 08:31:47.657900
"""

```python
from typing import Callable, Any


class FallbackExecutor:
    """
    A class that provides a fallback mechanism for executing functions.

    This class allows defining multiple execution methods for a task,
    and tries each one in order until a successful execution is achieved.
    If all methods fail, the last error is returned.

    :param fallback_methods: A list of callables to be attempted in sequence
                             when executing the task.
    :type fallback_methods: List[Callable[[Any], Any]]

    Usage:
        def method1(input_data: Any) -> Any:
            return input_data + 10

        def method2(input_data: Any) -> Any:
            return 'fallback value'

        fallback_executor = FallbackExecutor([method1, method2])
        result = fallback_executor.execute(5)
    """

    def __init__(self, fallback_methods: list[Callable[[Any], Any]]):
        self.fallback_methods = fallback_methods

    def execute(self, input_data: Any) -> Any:
        """
        Tries to execute the given data with each fallback method in sequence.

        :param input_data: The data to be passed as an argument to the methods.
        :type input_data: Any
        :return: The result of the first successful execution or the last error message.
        :rtype: Any

        :raises Exception: If all methods fail and no result is obtained.
        """
        for method in self.fallback_methods:
            try:
                return method(input_data)
            except Exception as e:
                print(f"Failed to execute {method.__name__} with error: {str(e)}")
        raise Exception("All fallback methods failed.")


# Example usage
def method1(input_data: Any) -> Any:
    return input_data + 10


def method2(input_data: Any) -> Any:
    return 'fallback value'


fallback_executor = FallbackExecutor([method1, method2])
result = fallback_executor.execute(5)
print(result)  # Output should be 15 if method1 succeeds; otherwise, 'fallback value'
```