Junior — Senior
Decorator that invokes callbacks when specified exceptions occur
livecode
Task condition
It is necessary to implement a decorator that takes a list of tuples — each tuple contains an exception type and a handler function. If, during the execution of the function to which the decorator is applied, one of the listed exceptions occurs, the corresponding handler is called.
def exception_handler(pairs: list[tuple[Exception, Callable[[], None]]]):
...