Add option to trigger stats when exceptions occur