Trying to add error handling for chains.ess calculation