Please sign in to comment.
Add error flags for throwing errors back into generator
The following code demonstrates this behavior. As foo.on_error is 'throw_last' the on_error_1 handler is executed as well as on_error_2 which is the exception throwed back to the bar handler. from circuits import Event, Component, handler, Debugger import pytest class foo(Event): on_error = 'throw_last' class bar(Event): pass class Foo(Component): @handler('foo', priority=2) def _on_error_1(self): raise ValueError('test') @handler('foo', priority=1) def _on_error_2(self): raise ValueError('test2') def bar(self): with pytest.raises(ValueError) as exc: x = yield self.call(foo()) assert exc.value.args == 'test2' print('DONE') x = Foo() x += Debugger() x.fire(bar()) x.run()
- Loading branch information...
Showing with 10 additions and 4 deletions.