// Already recovering, prevent error which happens more than once too fast to trigger another recover
if(isRecovering)return;
isRecovering=true;
// 1 ms timeout to avoid react breaking when re-rendering
setTimeout(()=>{
try{
// Prevent a crash loop with an error that could not be handled
if(!shouldAttemptRecover){
try{
showNotification({
color:"#eed202",
title:"Discord has crashed!",
body:"Awn :( Discord has crashed two times rapidly, not attempting to recover.",
noPersist: true,
noPersist: true
});
}catch{}
@ -96,13 +105,16 @@ export default definePlugin({
shouldAttemptRecover=false;
// This is enough to avoid a crash loop
setTimeout(()=>shouldAttemptRecover=true,500);
}catch{}
try{
if(!hasCrashedOnce){
hasCrashedOnce=true;
maybePromptToUpdate("Uh oh, Discord has just crashed... but good news, there is a Vencord update available that might fix this issue! Would you like to update now?",true);
}
}catch{}
try{
if(settings.store.attemptToPreventCrashes){
this.handlePreventCrash(_this);
}
@ -118,7 +130,7 @@ export default definePlugin({
color:"#eed202",
title:"Discord has crashed!",
body:"Attempting to recover...",
noPersist: true,
noPersist: true
});
}catch{}
@ -169,6 +181,10 @@ export default definePlugin({
}
}
// Set isRecovering to false before setting the state to allow us to handle the next crash error correcty, in case it happens