From 0cf283120b172acca370a436db8451e02f346e29 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Fri, 11 Dec 2020 16:40:46 +0100 Subject: [PATCH] @grafana-runtime: Throw error if health check fails in DataSourceWithBackend (#29743) --- packages/grafana-runtime/src/utils/DataSourceWithBackend.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts b/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts index ebe0b12774d..c2e30650dd5 100644 --- a/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts +++ b/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts @@ -172,6 +172,7 @@ export class DataSourceWithBackend< /** * Checks the plugin health + * see public/app/features/datasources/state/actions.ts for what needs to be returned here */ async testDatasource(): Promise { return this.callHealthCheck().then(res => { @@ -181,10 +182,7 @@ export class DataSourceWithBackend< message: res.message, }; } - return { - status: 'fail', - message: res.message, - }; + throw new Error(res.message); }); } }