Handle exceptions in bdd hooks.

Without this an exception in a before hook (for example) would cause tests to hang.