Add exception tracking code