Added error handling to store.js