"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 20:06:32.241740
"""

```python
from typing import Callable, Any


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

    Parameters:
        - primary_func (Callable): The main function to execute.
        - backup_func (Callable): An alternative function to use if the primary function fails.
        - error_types (tuple[type[BaseException]], optional): Types of exceptions to catch. Defaults to catching all types.

    Methods:
        - run: Executes the primary function, and if it raises an exception, attempts to execute the backup function.
    """

    def __init__(self, primary_func: Callable[..., Any], backup_func: Callable[..., Any],
                 error_types: tuple[type[BaseException]] = ()):
        self.primary_func = primary_func
        self.backup_func = backup_func
        self.error_types = error_types

    def run(self) -> Any:
        try:
            return self.primary_func()
        except self.error_types as e:
            print(f"Primary function failed: {e}")
            return self.backup_func()


# Example usage
def main_function() -> str:
    """Main function that might fail"""
    raise ValueError("Something went wrong in the primary function")


def backup_function() -> str:
    """Backup function to handle errors"""
    return "Using backup function"


if __name__ == "__main__":
    # Create an instance of FallbackExecutor
    fallback = FallbackExecutor(main_function, backup_function)
    
    # Run the executor and print the result
    result = fallback.run()
    print(result)  # Should output: Using backup function
```