feat(cache): improve error message in console

No need to try and give the data found in localStorage, just say what went wrong and move on.
This commit is contained in:
Lucien Cartier-Tilet 2023-05-08 10:36:19 +02:00
parent e02a336353
commit 85da82cd70
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -48,11 +48,7 @@ if (isDataOutdated(props.name)) {
try {
emits('cached', of(JSON.parse(data)));
} catch (err) {
console.error(
`Could not parse ${JSON.stringify(
dataFromCache
)}: ${err}. Fetching again data from API.`
);
console.error(`Could not parse data found in cache: ${err}`);
emits('cached', storeInCache(props.callback(), props.name));
}
}