Skip to content

Commit

Permalink
UIIN-2686: "Saving instance failed" modal does not show error message…
Browse files Browse the repository at this point in the history
… (follow-up) (#2359)
  • Loading branch information
mariia-aloshyna authored Nov 30, 2023
1 parent d910d32 commit 7e6b804
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Instance/InstanceEdit/InstanceEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import React, {
} from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router';
import { FormattedMessage } from 'react-intl';
import {
FormattedMessage,
useIntl,
} from 'react-intl';

import {
stripesConnect,
Expand Down Expand Up @@ -38,6 +41,7 @@ const InstanceEdit = ({
referenceData,
stripes,
}) => {
const { formatMessage } = useIntl();
const { identifierTypesById, identifierTypesByName } = referenceData ?? {};
const [httpError, setHttpError] = useState();
const [initialValues, setInitialValues] = useState();
Expand Down Expand Up @@ -76,8 +80,9 @@ const InstanceEdit = ({
const onError = async error => {
const response = await error.response;
const parsedError = await parseHttpError(response);
const defaultErrorMessage = formatMessage({ id: 'ui-inventory.communicationProblem' });
const err = {
message: parsedError?.errors[0]?.message,
message: parsedError?.message || parsedError?.errors?.[0]?.message || defaultErrorMessage,
status: response.status,
};

Expand Down

0 comments on commit 7e6b804

Please sign in to comment.