Skip to content

Commit

Permalink
UIPQB-57 show error message from response
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs committed Oct 13, 2023
1 parent b3aff77 commit b9951af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ export const QueryBuilderModal = ({
onQueryTestSuccess: () => {
setIsQueryRetrieved(false);
},
onQueryTestFail: () => {
onQueryTestFail: async (err) => {
const { message } = await err.response.json();

showCallout({
message: <FormattedMessage id="ui-plugin-query-builder.error.sww" />,
message: message || <FormattedMessage id="ui-plugin-query-builder.error.sww" />,
type: 'error',
});
setIsQueryRetrieved(false);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useTestQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});

Expand Down

0 comments on commit b9951af

Please sign in to comment.