Call dispatch:beforeException on exceptions in event handlers

See #1763