"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-07 12:32:09.882587
"""

```python
class FallbackExecutor:
    """
    A class for managing fallback execution in case primary functions fail.

    Args:
        primary_function (callable): The main function to execute.
        fallback_function (callable, optional): The function to run if `primary_function` fails.
                                                If not provided, a simple error message is displayed as the fallback.
    
    Raises:
        Exception: Raised by `primary_function`.
    """

    def __init__(self, primary_function: callable, fallback_function: callable = None):
        self.primary_function = primary_function
        self.fallback_function = fallback_function

    def execute(self) -> any:
        """
        Executes the `primary_function` and handles exceptions by falling back to `fallback_function`.

        Returns:
            The result of `primary_function` or `fallback_function`, if an exception occurs.
        
        Raises:
            Exception: If no fallback is provided and an error occurs in `primary_function`.
        """
        try:
            return self.primary_function()
        except Exception as e:
            if self.fallback_function:
                print(f"An error occurred while executing the primary function: {e}")
                return self.fallback_function()
            else:
                raise e

# Example usage
def main_function() -> int:
    """Primary function that might fail."""
    result = 10 / 0  # Intentionally cause a division by zero error.
    return result

def fallback_function() -> str:
    """Fallback function to provide an alternative response."""
    return "Executing fallback due to an error."

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

# Execute the functions with and without fallback
try:
    print("Primary result:", executor.execute())
except Exception as e:
    print(f"Error: {e}")

print("\nUsing fallback:", executor.execute())

```