"""Create fallback_executor
Generated by Phi-Octopus Eden
2025-11-06 19:06:25.996594
"""

```python
class FallbackExecutor:
    """
    A class for executing tasks that can fallback to a default action if an exception occurs.

    Parameters:
        task (callable): The main task function to be executed.
        fallback (callable): The fallback function to be executed in case of an error.
    
    Raises:
        Exception: If the main task fails and no fallback is defined or fails as well.
    """
    def __init__(self, task: callable, fallback: callable = None):
        self.task = task
        self.fallback = fallback

    def execute(self) -> object:
        """Executes the main task. If an exception occurs, it attempts to use the fallback."""
        try:
            return self.task()
        except Exception as e:
            if self.fallback is not None:
                print(f"Main task failed with error: {e}. Trying fallback...")
                return self.fallback()
            else:
                raise

# Example usage
def main_task():
    # Simulate a division by zero error
    result = 1 / 0
    return result

def fallback_task():
    # Simple fallback that returns an error message
    return "Fallback task executed due to an error."

executor = FallbackExecutor(main_task, fallback_task)
try:
    print(executor.execute())
except Exception as e:
    print(f"Final exception: {e}")
```