add try catch for d3