Commit 5deba92d by Erik Sundell

stackdriver: fix failing tests

parent ae8a7651
......@@ -200,11 +200,9 @@ export default class StackdriverDatasource {
message = error;
} else {
message = 'Stackdriver: ';
message += error.statusText ? error.statusText + ': ' : '';
message += error.statusText ? error.statusText : defaultErrorMessage;
if (error.data && error.data.error && error.data.error.code) {
message += error.data.error.code + '. ' + error.data.error.message;
} else {
message = defaultErrorMessage;
message += ': ' + error.data.error.code + '. ' + error.data.error.message;
}
}
} finally {
......
......@@ -6,7 +6,7 @@ import { TemplateSrvStub } from 'test/specs/helpers';
describe('StackdriverDataSource', () => {
const instanceSettings = {
jsonData: {
projectName: 'testproject',
defaultProject: 'testproject',
},
};
const templateSrv = new TemplateSrvStub();
......@@ -54,7 +54,7 @@ describe('StackdriverDataSource', () => {
Promise.reject({
statusText: 'Bad Request',
data: {
error: JSON.stringify({ error: { code: 400, message: 'Field interval.endTime had an invalid value' } }),
error: { code: 400, message: 'Field interval.endTime had an invalid value' },
},
}),
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment