def test_transaction_hook_with_broken_hook(self):
        run_hook = []

        class RootController(object):
            @expose()
            def index(self):
                return 'Hello, World!'

        def gen(event):
            return lambda: run_hook.append(event)

        class MyCustomException(Exception):
            pass

        class MyHook(PecanHook):

            def on_route(self, state):
                raise MyCustomException('BROKEN!')

        app = TestApp(make_app(RootController(), hooks=[
            MyHook(),
            TransactionHook(
                start=gen('start'),
                start_ro=gen('start_ro'),
                commit=gen('commit'),
                rollback=gen('rollback'),
                clear=gen('clear')
            )
        ]))

        self.assertRaises(
            MyCustomException,
            app.get,
            '/'
        )

        assert len(run_hook) == 1
        assert run_hook[0] == 'clear'
In a scenario where a preceding hook throws an exception,
dataset/ETHPy150Open pecan/pecan/pecan/tests/test_hooks.py/TestTransactionHook.test_transaction_hook_with_broken_hook