"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 20:30:29.296211
"""

```python
from typing import Callable, Any, Dict

class FallbackExecutor:
    """
    A class that provides a mechanism for executing functions with fallbacks in case of errors.

    :param primary_func: The primary function to be executed.
    :param fallback_funcs: A dictionary where keys are exception types and values are the corresponding fallback functions.
    """

    def __init__(self, primary_func: Callable[..., Any], fallback_funcs: Dict[type, Callable[..., Any]]):
        self.primary_func = primary_func
        self.fallback_funcs = fallback_funcs

    def execute(self) -> Any:
        """
        Attempts to execute the primary function. If an exception occurs during execution,
        it tries to use a fallback function based on the type of the exception.

        :return: The result of the executed function.
        """
        try:
            return self.primary_func()
        except Exception as e:
            for exception_type, fallback_func in self.fallback_funcs.items():
                if isinstance(e, exception_type):
                    print(f"Primary function failed with {type(e).__name__}, trying fallback...")
                    return fallback_func()
            raise

# Example usage
def primary_task() -> int:
    """
    A sample task that may fail.
    
    :return: An integer result or raises an error.
    """
    import random
    
    if random.random() < 0.5:
        print("Task failed due to random condition.")
        return -1
    else:
        print("Task succeeded!")
        return 42

def fallback_task() -> int:
    """
    A sample fallback task that will be used in case of failure.
    
    :return: An integer result.
    """
    print("Executing fallback task...")
    return 0

# Create a FallbackExecutor instance
executor = FallbackExecutor(primary_task, {ValueError: fallback_task})

# Execute the primary function with fallbacks
result = executor.execute()
print(f"Final result: {result}")
```