Add exception logging