mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-28 18:36:26 +00:00
try catch loading spotify cache
This commit is contained in:
parent
7930ecbc95
commit
9400b0855b
|
@ -401,7 +401,13 @@ class Spotify extends Plugin {
|
|||
let cache
|
||||
try {
|
||||
cache = JSON.parse(fs.readFileSync(this.configFolder+'cache.json'))
|
||||
} catch {
|
||||
} catch (e){
|
||||
if (e.name === "SyntaxError"){
|
||||
fs.writeFileSync(this.configFolder+'cache.json', JSON.stringify(
|
||||
{tracks: {}, albums: {}},
|
||||
null, 2
|
||||
))
|
||||
}
|
||||
cache = {tracks: {}, albums: {}}
|
||||
}
|
||||
return cache
|
||||
|
|
Loading…
Reference in a new issue