diff --git a/public/app/core/controllers/inspect_ctrl.js b/public/app/core/controllers/inspect_ctrl.js
index 2adc62f0039..0f8582ef5ce 100644
--- a/public/app/core/controllers/inspect_ctrl.js
+++ b/public/app/core/controllers/inspect_ctrl.js
@@ -7,7 +7,7 @@ define([
function (angular, _, $, coreModule) {
'use strict';
- coreModule.default.controller('InspectCtrl', function($scope) {
+ coreModule.default.controller('InspectCtrl', function($scope, $sanitize) {
var model = $scope.inspector;
function getParametersFromQueryString(queryString) {
@@ -32,7 +32,11 @@ function (angular, _, $, coreModule) {
if (_.isString(model.error.data)) {
$scope.response = $("
" + model.error.data + "
").text();
} else if (model.error.data) {
- $scope.response = angular.toJson(model.error.data, true);
+ if (model.error.data.response) {
+ $scope.response = $sanitize(model.error.data.response);
+ } else {
+ $scope.response = angular.toJson(model.error.data, true);
+ }
} else if (model.error.message) {
$scope.message = model.error.message;
}
diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts
index 17299f452a3..fdc2b6cb974 100644
--- a/public/app/core/services/backend_srv.ts
+++ b/public/app/core/services/backend_srv.ts
@@ -138,7 +138,8 @@ export class BackendSrv {
//populate error obj on Internal Error
if (_.isString(err.data) && err.status === 500) {
err.data = {
- error: err.statusText
+ error: err.statusText,
+ response: err.data,
};
}