diff --git a/src/QueryBuilder/QueryBuilder/QueryBuilderModal/QueryBuilderModal.js b/src/QueryBuilder/QueryBuilder/QueryBuilderModal/QueryBuilderModal.js
index 89e0447b..65565521 100644
--- a/src/QueryBuilder/QueryBuilder/QueryBuilderModal/QueryBuilderModal.js
+++ b/src/QueryBuilder/QueryBuilder/QueryBuilderModal/QueryBuilderModal.js
@@ -77,9 +77,11 @@ export const QueryBuilderModal = ({
onQueryTestSuccess: () => {
setIsQueryRetrieved(false);
},
- onQueryTestFail: () => {
+ onQueryTestFail: async (err) => {
+ const response = await err?.response.json();
+
showCallout({
- message: ,
+ message: response?.message || ,
type: 'error',
});
setIsQueryRetrieved(false);
diff --git a/src/hooks/useTestQuery.js b/src/hooks/useTestQuery.js
index 317239c8..54074401 100644
--- a/src/hooks/useTestQuery.js
+++ b/src/hooks/useTestQuery.js
@@ -13,9 +13,9 @@ export const useTestQuery = ({ testQueryDataSource, onQueryTestSuccess, onQueryT
} = useMutation({
mutationFn: ({ entityTypeId, fqlQuery }) => testQueryDataSource({ entityTypeId, fqlQuery }),
onSuccess: onQueryTestSuccess,
- onError: () => {
+ onError: (err) => {
setIsTestQueryInProgress(false);
- onQueryTestFail();
+ onQueryTestFail(err);
},
});