Skip to content
Snippets Groups Projects
Commit 0117588e authored by Piotr Gawron's avatar Piotr Gawron
Browse files

reject with error

parent 2fcbc7da
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!199Resolve "[MIN-321] form for reporting errors in minerva"
......@@ -3,8 +3,8 @@ import type { AppDispatch, store } from '@/redux/store';
import { BioEntityContent } from '@/types/models';
import { PerfectMultiSearchParams } from '@/types/search';
import { ThunkConfig } from '@/types/store';
import { getErrorMessage } from '@/utils/getErrorMessage';
import { PayloadAction, createAsyncThunk } from '@reduxjs/toolkit';
import { getError } from '@/utils/error-report/getError';
import { addNumbersToEntityNumberData } from '../../entityNumber/entityNumber.slice';
import { MULTI_BIO_ENTITY_FETCHING_ERROR_PREFIX } from '../bioEntity.constants';
import { getBioEntity } from './getBioEntity';
......@@ -20,7 +20,7 @@ export const getMultiBioEntity = createAsyncThunk<
>(
'project/getMultiBioEntity',
// eslint-disable-next-line consistent-return
async ({ searchQueries, isPerfectMatch }, { dispatch, rejectWithValue, getState }) => {
async ({ searchQueries, isPerfectMatch }, { dispatch, getState }) => {
try {
const asyncGetBioEntityFunctions = searchQueries.map(searchQuery =>
dispatch(getBioEntity({ searchQuery, isPerfectMatch, addNumbersToEntityNumber: false })),
......@@ -50,12 +50,7 @@ export const getMultiBioEntity = createAsyncThunk<
return bioEntityContents;
} catch (error) {
const errorMessage = getErrorMessage({
error,
prefix: MULTI_BIO_ENTITY_FETCHING_ERROR_PREFIX,
});
return rejectWithValue(errorMessage);
return Promise.reject(getError({ error, prefix: MULTI_BIO_ENTITY_FETCHING_ERROR_PREFIX }));
}
},
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment