Improve error reporting for plugin misconfig

This commit is contained in:
Adam Harvey
2021-01-24 23:53:03 -05:00
parent c3ea694e84
commit a6e3b9596a
2 changed files with 14 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-kubernetes': patch
---
Improve error reporting for plugin misconfiguration.
@@ -43,7 +43,15 @@ export class KubernetesBackendClient implements KubernetesApi {
if (!response.ok) {
const payload = await response.text();
const message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;
let message;
switch (response.status) {
case 404:
message =
'Could not find the Kubernetes Backend (HTTP 404). Make sure the plugin has been fully installed.';
break;
default:
message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;
}
throw new Error(message);
}