Fix bug where before hook exceptions were being ignored

Ref #722