forked from XiaoMo/ChatGPT-Next-Web
fix: try catch errors
This commit is contained in:
parent
b4b11a470f
commit
ca679e86b4
@ -10,7 +10,7 @@ const LANG_KEY = 'lang'
|
|||||||
function getItem(key: string) {
|
function getItem(key: string) {
|
||||||
try {
|
try {
|
||||||
return localStorage.getItem(key)
|
return localStorage.getItem(key)
|
||||||
} finally {
|
} catch {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,13 +18,13 @@ function getItem(key: string) {
|
|||||||
function setItem(key: string, value: string) {
|
function setItem(key: string, value: string) {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(key, value)
|
localStorage.setItem(key, value)
|
||||||
} finally { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLanguage() {
|
function getLanguage() {
|
||||||
try {
|
try {
|
||||||
return navigator.language.toLowerCase()
|
return navigator.language.toLowerCase()
|
||||||
} finally {
|
} catch {
|
||||||
return 'cn'
|
return 'cn'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user