feat: try catch for JSON.parse

This commit is contained in:
DIYgod 2023-07-31 23:34:38 +01:00
parent 9384b51f58
commit 0d9333d955
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -65,7 +65,11 @@ export async function cacheGet(options: {
})
}, Math.random() * REDIS_REFRESH)
}
return JSON.parse(cacheValue)
try {
return JSON.parse(cacheValue)
} catch (error) {
return cacheValue
}
} else {
if (options.allowEmpty) {
options.getValueFun().then((value) => {