Skip to content

Commit 9093f51

Browse files
authored
Improve installation error handling (#236)
* Add hint to restart Grafana when not able to connect on install, fix handling of 502 during install which did not give useful feedback * Lint
1 parent d8931cb commit 9093f51

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

grafana-plugin/src/containers/PluginConfigPage/PluginConfigPage.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const PluginConfigPage = (props: Props) => {
6868
provisioningConfig = await makeRequest('/plugin/self-hosted/install', { method: 'POST' });
6969
} catch (e) {
7070
if (e.response.status === 502) {
71-
console.warn('Could not connect to OnCall: ' + plugin.meta.jsonData.onCallApiUrl);
71+
console.warn('Could not connect to OnCall: ' + onCallApiUrl);
7272
} else if (e.response.status === 403) {
7373
console.warn('Invitation token is invalid or expired.');
7474
} else {
@@ -130,13 +130,11 @@ export const PluginConfigPage = (props: Props) => {
130130

131131
const handleSyncException = useCallback((e) => {
132132
if (plugin.meta.jsonData?.onCallApiUrl) {
133-
setPluginStatusMessage(
134-
'Tried connecting to OnCall: ' +
135-
plugin.meta.jsonData.onCallApiUrl +
136-
'\n' +
137-
e +
138-
', retry or check settings & re-initialize.'
139-
);
133+
let statusMessage = plugin.meta.jsonData.onCallApiUrl + '\n' + e + ', retry or check settings & re-initialize.';
134+
if (e.response.status == 404) {
135+
statusMessage += '\nIf Grafana OnCall was just installed, restart Grafana for OnCall routes to be available.';
136+
}
137+
setPluginStatusMessage(statusMessage);
140138
setRetrySync(true);
141139
} else {
142140
setPluginStatusMessage('OnCall has not been setup, configure & initialize below.');

0 commit comments

Comments
 (0)