Skip to content

Commit 27e0140

Browse files
author
wellenvogel
committed
#553: better error handling for stopped server when querying plugins
1 parent 6992f14 commit 27e0140

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

viewer/util/pluginmanager.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,7 @@ class Pluginmanager{
480480
const foundPlugins={};
481481
queries.push(this.query().then((plugins)=>{
482482
if (!plugins || !(plugins instanceof Array)) {
483-
if (alarmhandler.isBlocked(LOCAL_TYPES.connectionLost)) return;
484-
Toast("unable to query plugins");
485-
return;
483+
throw new Error("no plugins returned")
486484
}
487485
for (let plugin of plugins) {
488486
const name = plugin.name;
@@ -494,7 +492,14 @@ class Pluginmanager{
494492
queries.push(this.queryUser().then((userFiles)=>{
495493
foundPlugins[userFiles.name] = userFiles;
496494
}));
497-
await Promise.all(queries);
495+
try {
496+
await Promise.all(queries);
497+
}catch (e){
498+
base.error("unable to query plugins",e);
499+
if (alarmhandler.isBlocked(LOCAL_TYPES.connectionLost)) return;
500+
Toast("unable to query plugins");
501+
return;
502+
}
498503
base.log("got plugin/user info");
499504
let unloadedJsChanges=false;
500505
let updatedMjs=false;

0 commit comments

Comments
 (0)