feat: try catch for JSON.parse
This commit is contained in:
parent
9384b51f58
commit
0d9333d955
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue