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