catches exceptions thrown by agents