"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-08 10:36:30.118068
"""

```python
from typing import Callable, Any


class FallbackExecutor:
    """
    A class for creating a fallback execution mechanism to recover from errors in dynamic task execution.
    
    Attributes:
        primary_func (Callable): The main function to be executed with arguments and keyword arguments.
        fallback_func (Callable, optional): The secondary function that is called if the primary function fails. Defaults to None.
        
    Methods:
        execute: Attempts to run the primary function. If an exception occurs, attempts to run the fallback function.
    """
    
    def __init__(self, primary_func: Callable, fallback_func: Callable = None):
        self.primary_func = primary_func
        self.fallback_func = fallback_func

    def execute(self, *args: Any, **kwargs: Any) -> Any:
        """
        Execute the primary function with provided arguments and keyword arguments.
        
        If an exception occurs during execution of the primary function, attempt to run the fallback function if provided.
        
        Args:
            *args: Positional arguments for the function.
            **kwargs: Keyword arguments for the function.

        Returns:
            The result of the successfully executed function or None in case of failure without a fallback.
            
        Raises:
            Any exceptions raised by the functions will be propagated unless caught and handled within the fallback mechanism.
        """
        try:
            return self.primary_func(*args, **kwargs)
        except Exception as e:
            if self.fallback_func is not None:
                print(f"Error in primary function: {e}")
                try:
                    return self.fallback_func(*args, **kwargs)
                except Exception as fallback_e:
                    print(f"Error in fallback function: {fallback_e}")
            else:
                raise


# Example usage
def main_function(x: int) -> str:
    """Multiply input by 2 and return a string."""
    result = x * 2
    if result > 10:
        raise ValueError("Result exceeds limit.")
    return f"Double of {x} is {result}"

def fallback_function(x: int) -> str:
    """Add 5 to the input and return a string."""
    return f"Incremented by 5, value is now {x + 5}"


# Create an instance of FallbackExecutor
executor = FallbackExecutor(main_function, fallback_func=fallback_function)

try:
    # Successful execution with no exception
    print(executor.execute(3))  # Output: Double of 3 is 6
except Exception as e:
    print(f"Primary function failed with {e}")

try:
    # Failed execution with primary function handling the error and invoking fallback
    print(executor.execute(12))  # Error in primary function: Result exceeds limit.
                                # Output: Incremented by 5, value is now 17
except Exception as e:
    print(f"Primary or fallback function failed with {e}")
```