Commit cdd5ba61 by Torkel Ödegaard

fix: influxdb test data source error handling now works better, fixes #8577

parent 6c040572
...@@ -200,10 +200,7 @@ export default class InfluxDatasource { ...@@ -200,10 +200,7 @@ export default class InfluxDatasource {
} }
return { status: "success", message: "Data source is working", title: "Success" }; return { status: "success", message: "Data source is working", title: "Success" };
}).catch(err => { }).catch(err => {
if (err.data && err.message) { return { status: "error", message: err.message, title: "Test Failed" };
return { status: "error", message: err.data.message, title: "InfluxDB Error" };
}
return { status: "error", message: err.toString(), title: "InfluxDB Error" };
}); });
} }
...@@ -250,9 +247,9 @@ export default class InfluxDatasource { ...@@ -250,9 +247,9 @@ export default class InfluxDatasource {
}, function(err) { }, function(err) {
if (err.status !== 0 || err.status >= 300) { if (err.status !== 0 || err.status >= 300) {
if (err.data && err.data.error) { if (err.data && err.data.error) {
throw { message: 'InfluxDB Error Response: ' + err.data.error, data: err.data, config: err.config }; throw { message: 'InfluxDB Error: ' + err.data.error, data: err.data, config: err.config };
} else { } else {
throw { message: 'InfluxDB Error: ' + err.message, data: err.data, config: err.config }; throw { message: 'Network Error: ' + err.statusText + '(' + err.status + ')', data: err.data, config: err.config };
} }
} }
}); });
......
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