Skip to content

Commit 9dd2984

Browse files
committed
Show more specific error message after open root file
1 parent 7967032 commit 9dd2984

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

modules/gui/HierarchyPainter.mjs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,12 +3062,15 @@ class HierarchyPainter extends BasePainter {
30623062
}
30633063

30643064
return this.refreshHtml();
3065-
}).catch(() => {
3065+
}).catch(err => {
30663066
// make CORS warning
3067-
if (isBatchMode())
3068-
console.error(`Fail to open ${msg} - check CORS headers`);
3069-
else if (!d3_select('#gui_fileCORS').style('background', 'red').empty())
3070-
setTimeout(() => d3_select('#gui_fileCORS').style('background', ''), 5000);
3067+
const elem = isBatchMode() ? null : d3_select('#gui_fileCORS');
3068+
if (!elem || elem.empty())
3069+
console.error(`Fail to open ${msg} - ${err?.message ?? 'check CORS headers'}`);
3070+
else {
3071+
elem.style('background', 'red');
3072+
setTimeout(() => elem.style('background', ''), 5000);
3073+
}
30713074
return false;
30723075
}).finally(() => showProgress());
30733076
}

0 commit comments

Comments
 (0)