def test_pipe_exception_handler(): class MyException(Exception): pass with pytest.raises(MyException) as excinfo: with pipe_exception_handler('NAME'): raise MyException('boo hoo') assert excinfo.value.message == "boo hoo\n in NAME"
def composite(*args, **kwargs): with pipe_exception_handler('maybe ?| ' + name): result = first(*args, **kwargs) return None if result is None else second(result)
def composite(*args, **kwargs): with pipe_exception_handler('pipe | ' + name): return second(first(*args, **kwargs))