"""Create error_monitor
Generated by Phi-Octopus Eden
2025-11-05 22:04:26.547480
"""

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


def create_error_monitor(error_handler: Callable[[Exception], None]) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
    """
    Create an error monitoring decorator that catches errors and invokes a custom handler.

    Args:
        error_handler (Callable[[Exception], None]): A function to handle the caught exceptions. It should accept an
                                                     exception as its single argument.

    Returns:
        Callable[[Callable[..., Any]], Callable[..., Any]]: A decorator that can be applied to any function.
    """
    def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
        """
        Decorator that monitors errors in the wrapped function and invokes the error_handler if an exception occurs.

        Args:
            func (Callable[..., Any]): The function to be decorated.

        Returns:
            Callable[..., Any]: The wrapped function with error monitoring.
        """
        def wrapper(*args: Any, **kwargs: Any) -> Any:
            try:
                return func(*args, **kwargs)
            except Exception as e:
                logging.error(f"Error occurred in {func.__name__}: {str(e)}")
                error_handler(e)
        return wrapper
    return decorator


# Example usage and error handler function
def log_and_print_error(exc: Exception):
    """Handler that logs the error to a file and prints it to console."""
    logging.basicConfig(level=logging.ERROR, filename="error.log", filemode="a",
                        format="%(asctime)s - %(levelname)s - %(message)s")
    print(f"Error handled: {exc}")


@create_error_monitor(error_handler=log_and_print_error)
def risky_function(a: int, b: int) -> float:
    """Example of a function that might fail due to division by zero."""
    if b == 0:
        raise ZeroDivisionError("Attempted to divide by zero")
    return a / b


# Running the example function
risky_function(10, 2)
risky_function(10, 0)  # This will trigger an error and be handled
```

This code defines `create_error_monitor`, which is a decorator factory. It takes an error handler as an argument and returns a decorator that wraps another function to monitor for exceptions. If an exception occurs within the wrapped function, it logs the error using Python's built-in logging module and invokes the custom error handler.

The example usage demonstrates how to apply this decorator to a risky function that might raise a `ZeroDivisionError`. The provided error handler both prints the error message to the console and writes it to a log file.