Use try catch in storeData for localStorage