Commit 8bdc47b5 authored by Nathan Friend's avatar Nathan Friend

Restructure error handling in lead time charts

parent e35b4ce3
......@@ -55,28 +55,25 @@ export default {
async mounted() {
const results = await Promise.allSettled(
allChartDefinitions.map(async ({ id, requestParams, startDate, endDate }) => {
let apiData;
if (this.projectPath && this.groupPath) {
throw new Error('Both projectPath and groupPath were provided');
} else if (this.projectPath) {
apiData = (
await DoraApi.getProjectDoraMetrics(
}
if (!this.projectPath && !this.groupPath) {
throw new Error('Either projectPath or groupPath must be provided');
}
const { data: apiData } = this.projectPath
? await DoraApi.getProjectDoraMetrics(
this.projectPath,
DoraApi.LEAD_TIME_FOR_CHANGES,
requestParams,
)
).data;
} else if (this.groupPath) {
apiData = (
await DoraApi.getGroupDoraMetrics(
: await DoraApi.getGroupDoraMetrics(
this.groupPath,
DoraApi.LEAD_TIME_FOR_CHANGES,
requestParams,
)
).data;
} else {
throw new Error('Either projectPath or groupPath must be provided');
}
);
this.chartData[id] = buildNullSeriesForLeadTimeChart(
apiDataToChartSeries(apiData, startDate, endDate, CHART_TITLE, null),
......
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