Alternatively a Protocol can be used instead of Callable
from typing import Protocol
class ErrorHandler(Protocol):
def __call__(self, p0: int, p1: Exception) -> None: ...
def handler(on_error: ErrorHandler): ...