Add try-catch
This commit is contained in:
@@ -306,6 +306,7 @@
|
|||||||
{#if DBState.db.useChatCopy && !blankMessage}
|
{#if DBState.db.useChatCopy && !blankMessage}
|
||||||
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-copy" onclick={async ()=>{
|
<button class="ml-2 hover:text-blue-500 transition-colors button-icon-copy" onclick={async ()=>{
|
||||||
if(window.navigator.clipboard.write){
|
if(window.navigator.clipboard.write){
|
||||||
|
try {
|
||||||
alertWait(language.loading)
|
alertWait(language.loading)
|
||||||
const root = document.querySelector(':root') as HTMLElement;
|
const root = document.querySelector(':root') as HTMLElement;
|
||||||
|
|
||||||
@@ -420,6 +421,10 @@
|
|||||||
alertNormal(language.copied)
|
alertNormal(language.copied)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
alertError(`Error, please try again: ${e.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
window.navigator.clipboard.writeText(msgDisplay).then(() => {
|
window.navigator.clipboard.writeText(msgDisplay).then(() => {
|
||||||
setStatusMessage(language.copied)
|
setStatusMessage(language.copied)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user