Skip to content

Commit

Permalink
fix: fix error handling when an error occurs during table twingraph q…
Browse files Browse the repository at this point in the history
…ueries
  • Loading branch information
nborde-CSM committed Oct 1, 2024
1 parent b32fd96 commit a984b58
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ export const GenericTable = ({

const _getDataFromTwingraphDataset = async (setClientFileDescriptor) => {
const fileName = `${parameterData.id}.csv`;
const _setClientFileDescriptorToError = () => {
setClientFileDescriptor({
file: null,
content: null,
agGridRows: null,
errors: null,
tableDataStatus: TABLE_DATA_STATUS.ERROR,
});
};

setClientFileDescriptor({
file: null,
content: null,
Expand All @@ -233,6 +243,7 @@ export const GenericTable = ({
'Impossible to fetch data from dataset because the list of datasets is empty'
),
});
_setClientFileDescriptorToError();
return;
}

Expand All @@ -246,6 +257,7 @@ export const GenericTable = ({
'Impossible to fetch data from dataset because there is no twingraph query defined for this parameter. '
),
});
_setClientFileDescriptorToError();
return;
}

Expand All @@ -257,6 +269,7 @@ export const GenericTable = ({
'Only twingraph datasets can be used to fetch table data dynamically'
),
});
_setClientFileDescriptorToError();
return;
}

Expand All @@ -274,14 +287,7 @@ export const GenericTable = ({
),
});
console.error(error?.response?.data?.detail);

setClientFileDescriptor({
file: null,
content: null,
agGridRows: null,
errors: null,
tableDataStatus: TABLE_DATA_STATUS.ERROR,
});
_setClientFileDescriptorToError();
return;
}

Expand All @@ -294,6 +300,7 @@ export const GenericTable = ({
'Please, check your solution'
),
});
_setClientFileDescriptorToError();
return;
}

Expand All @@ -308,6 +315,7 @@ export const GenericTable = ({
{ resultKey }
),
});
_setClientFileDescriptorToError();
return;
}

Expand Down

0 comments on commit a984b58

Please sign in to comment.