From ebdffe21e6bc0fc4dd056a473aada99c9332ece4 Mon Sep 17 00:00:00 2001 From: Levente Balogh Date: Thu, 7 Dec 2023 11:47:12 +0100 Subject: [PATCH] Plugins: Suppress 403 preloading errors (#79154) * fix: stop displaying error alerts when plugins cannot be loaded * fix: only hide the error if it is a 403 error * fix: revert unnecessary object spreading --- public/app/features/plugins/pluginSettings.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/app/features/plugins/pluginSettings.ts b/public/app/features/plugins/pluginSettings.ts index 81458fedcaa..135cdbb9e97 100644 --- a/public/app/features/plugins/pluginSettings.ts +++ b/public/app/features/plugins/pluginSettings.ts @@ -18,7 +18,13 @@ export function getPluginSettings(pluginId: string, options?: Partial { + .catch((e) => { + // User does not have access to plugin + if (typeof e === 'object' && e !== null && 'status' in e && e.status === 403) { + e.isHandled = true; + return Promise.reject(e); + } + return Promise.reject(new Error('Unknown Plugin')); }); }