Skip to content

Commit

Permalink
Merge pull request #222 from dbmdz/wemi_advanced-errormsg
Browse files Browse the repository at this point in the history
[METASVC-152] Add detailed error message to WEMI filling procedure
  • Loading branch information
daforster authored Feb 6, 2025
2 parents 527e82b + 6598016 commit e0600e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

### Added

- More detailed error message to WEMI filling procedure

## [9.5.1](https://github.com/dbmdz/metadata-service/releases/tag/9.5.1) - 2025-01-22

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,23 @@ private void expandByWemiObjects(DigitalObject digitalObject) throws ServiceExce
manifestationsWithWorks.parallelStream()
.filter(m -> Objects.equals(m.getUuid(), item.getManifestation().getUuid()))
.findFirst()
.get(); // must be there otherwise the SQL in getAllManifestationAndWorkUuids is wrong
// must be there otherwise the SQL in getAllManifestationAndWorkUuids is wrong
.orElseThrow(
() ->
new ServiceException(
"""
The item's manifestation could not be found although there must be one!
Item: %s;
Manifestation acc. to item: %s;
DigitalObject: %s
"""
.formatted(
item.getUuid().toString(),
Optional.ofNullable(item.getManifestation())
.map(Manifestation::getUuid)
.map(UUID::toString)
.orElse("<no UUID in manifestation>"),
digitalObject.getUuid().toString())));
item.setManifestation(manifestation);
setNewestLastModified.accept(digitalObject, manifestation);

Expand Down

0 comments on commit e0600e1

Please sign in to comment.