updated exception handler to collect more information