From 86a274a7eed37acb45f43c5e695e2bd6dce1b7d8 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 21 Mar 2016 12:30:13 +0100 Subject: [PATCH] feat(backendsrv): improves error response handling datasourceRequests that could not reach the destination threw invalid errors due to missing property. This fixes gives the user a better error message. closes #4428 --- public/app/core/services/backend_srv.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/app/core/services/backend_srv.js b/public/app/core/services/backend_srv.js index 6d0d112ba26..c5638af167e 100644 --- a/public/app/core/services/backend_srv.js +++ b/public/app/core/services/backend_srv.js @@ -105,6 +105,13 @@ function (angular, _, coreModule, config) { }); } + //populate error obj on Internal Error + if (_.isString(err.data) && err.status === 500 && !err.data) { + err.data = { + error: err.statusText + }; + } + // for Prometheus if (!err.data.message && _.isString(err.data.error)) { err.data.message = err.data.error;