Skip to content

Commit

Permalink
Added another path for entity error message to appear (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite authored Jan 24, 2023
1 parent 89fec57 commit a3cc539
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/submission/feed-entry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@ export default {
return '';
},
entityProblem(entry) {
if ('problem' in entry.details && 'problemDetails' in entry.details.problem)
if ('problem' in entry.details &&
'problemDetails' in entry.details.problem &&
'reason' in entry.details.problem.problemDetails)
return entry.details.problem.problemDetails.reason;
if ('problem' in entry.details &&
'errorMessage' in entry.details)
return entry.details.errorMessage;
return '';
}
}
Expand Down
14 changes: 14 additions & 0 deletions test/components/submission/feed-entry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ describe('SubmissionFeedEntry', () => {
title.get('.entity-error-message').text().should.equal('ID empty or missing.');
await title.get('.entity-error-message').should.have.textTooltip();
});

it('renders entity creation error message when it is included as an errorMessage', async () => {
testData.extendedAudits.createPast(1, {
action: 'entity.create.error',
details: {
problem: { problemCode: 409.3, problemDetails: { foo: 'blah' } },
errorMessage: 'A resource already exists with uuid value(s) abc.'
}
});
const title = mountComponent().get('.title');
title.get('.submission-feed-entry-entity-error').text().should.equal('Problem creating Entity');
title.get('.entity-error-message').text().should.equal('A resource already exists with uuid value(s) abc.');
await title.get('.entity-error-message').should.have.textTooltip();
});
});
});

Expand Down

0 comments on commit a3cc539

Please sign in to comment.