From 90216de74df02a8b91fc3bb387d563af7ec7f409 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Mon, 4 Jul 2022 14:30:57 +0100 Subject: [PATCH] Improve error message when plugin fails to load --- shell/core/plugins.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/core/plugins.js b/shell/core/plugins.js index a335623d5c..247860fd21 100644 --- a/shell/core/plugins.js +++ b/shell/core/plugins.js @@ -79,7 +79,11 @@ export default function({ element.onerror = (e) => { element.parentElement.removeChild(element); - reject(e); + // Massage the error into something useful + const errorMessage = `Failed to load script from '${ e.target.src }'`; + + console.error(errorMessage, e); // eslint-disable-line no-console + reject(new Error(errorMessage)); // Message on itThis is more useful where it's used }; document.head.appendChild(element);