Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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[0] == 'test2' print('DONE') x = Foo() x += Debugger() x.fire(bar()) x.run()
- Loading branch information