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
This commit is contained in:
Levente Balogh 2023-12-07 11:47:12 +01:00 committed by GitHub
parent 42ce9bd9f0
commit ebdffe21e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,13 @@ export function getPluginSettings(pluginId: string, options?: Partial<BackendSrv
pluginInfoCache[pluginId] = settings;
return settings;
})
.catch(() => {
.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'));
});
}