Skip to content

Commit

Permalink
fix(Sort,Merge): get rid of missing node errors [YTFRONT-4392]
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed Oct 2, 2024
1 parent 4897f6f commit cf79a79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import axios, {CancelTokenSource} from 'axios';
// @ts-ignore
import yt from '@ytsaurus/javascript-wrapper/lib/yt';
import ypath from '../../../../common/thor/ypath';
import {getBatchError, wrapApiPromiseByToaster} from '../../../../utils/utils';
import {
USE_SKIP_ERROR_FN_NODE_DOES_NOT_EXIST,
getBatchError,
wrapApiPromiseByToaster,
} from '../../../../utils/utils';
import {loadPoolTreesIfNotLoaded} from '../../../../store/actions/global';
import {OperationShortInfo} from '../../../../pages/components/OperationShortInfo/OperationShortInfo';
import {AppStoreProvider} from '../../../../containers/App/AppStoreProvider';
Expand Down Expand Up @@ -167,6 +171,7 @@ export const loadStorageAttributes =
errorTitle: 'Get table attributes request is failed',
autoHide: false,
skipSuccessToast: true,
...USE_SKIP_ERROR_FN_NODE_DOES_NOT_EXIST,
},
);

Expand Down
10 changes: 8 additions & 2 deletions packages/ui/src/ui/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface SplitedBatchResults<T> {
}

export const USE_IGNORE_NODE_DOES_NOT_EXIST = {ignoreErrorCodes: [YTErrors.NODE_DOES_NOT_EXIST]};
export const USE_SKIP_ERROR_FN_NODE_DOES_NOT_EXIST: Pick<
Required<CommonWrapApiOptions<unknown>>,
'skipErrorFn'
> = {
skipErrorFn: ({code}) => code === YTErrors.NODE_DOES_NOT_EXIST,
};

export function splitBatchResults<T = unknown>(
batchResults: Array<BatchResultsItem<T>>,
Expand Down Expand Up @@ -197,9 +203,9 @@ export function wrapApiPromiseByToaster<T>(p: Promise<T>, options: WrapApiOption

const {skipErrorFn, skipErrorToast} = options;

const isVisibleError = skipErrorFn ? skipErrorFn : (_e: unknown) => !skipErrorToast;
const isSkippedError = skipErrorFn ? skipErrorFn : (_e: unknown) => skipErrorToast;

if (isVisibleError(error)) {
if (!isSkippedError(error)) {
toaster.add({
name: options.toasterName,
theme: 'danger',
Expand Down

0 comments on commit cf79a79

Please sign in to comment.