Log exception when thrown.