handle exception in event handler