Skip to content

Commit

Permalink
(fix): add error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
NethmiRodrigo committed May 23, 2024
1 parent 94fc5d1 commit 20c259d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/repeat/repeat.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { FormContext } from '../../form-context';
import { getFieldControlWithFallback } from '../section/helpers';
import { clearSubmission } from '../../utils/common-utils';
import RepeatControls from './repeat-controls.component';
import { getGlobalStore } from '@openmrs/esm-framework';
import { createErrorHandler, getGlobalStore } from '@openmrs/esm-framework';

const renderingByTypeMap: Record<string, RenderType> = {
obsGroup: 'group',
Expand Down Expand Up @@ -113,7 +113,7 @@ const Repeat: React.FC<FormFieldProps> = ({ question, onChange, handler }) => {
if (handleConfirmQuestionDeletion && typeof handleConfirmQuestionDeletion === 'function') {
const result = handleConfirmQuestionDeletion(question);
if (result && typeof result.then === 'function' && typeof result.catch === 'function') {
result.then(() => removeNthRow(question)).catch(() => console.error('Modal has being cancelled'));
result.then(() => removeNthRow(question)).catch(() => createErrorHandler());
} else if (typeof result === 'boolean') {
result && removeNthRow(question);
} else {
Expand Down

0 comments on commit 20c259d

Please sign in to comment.