add try/catch for stringify