Skip to content

Commit e0600e1

Browse files
authored
Merge pull request #222 from dbmdz/wemi_advanced-errormsg
[METASVC-152] Add detailed error message to WEMI filling procedure
2 parents 527e82b + 6598016 commit e0600e1

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66

77
## Unreleased
88

9+
### Added
10+
11+
- More detailed error message to WEMI filling procedure
12+
913
## [9.5.1](https://github.com/dbmdz/metadata-service/releases/tag/9.5.1) - 2025-01-22
1014

1115
### Fixed

metasvc-server/business/src/main/java/io/github/dbmdz/metadata/server/business/impl/service/identifiable/entity/DigitalObjectServiceImpl.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,23 @@ private void expandByWemiObjects(DigitalObject digitalObject) throws ServiceExce
373373
manifestationsWithWorks.parallelStream()
374374
.filter(m -> Objects.equals(m.getUuid(), item.getManifestation().getUuid()))
375375
.findFirst()
376-
.get(); // must be there otherwise the SQL in getAllManifestationAndWorkUuids is wrong
376+
// must be there otherwise the SQL in getAllManifestationAndWorkUuids is wrong
377+
.orElseThrow(
378+
() ->
379+
new ServiceException(
380+
"""
381+
The item's manifestation could not be found although there must be one!
382+
Item: %s;
383+
Manifestation acc. to item: %s;
384+
DigitalObject: %s
385+
"""
386+
.formatted(
387+
item.getUuid().toString(),
388+
Optional.ofNullable(item.getManifestation())
389+
.map(Manifestation::getUuid)
390+
.map(UUID::toString)
391+
.orElse("<no UUID in manifestation>"),
392+
digitalObject.getUuid().toString())));
377393
item.setManifestation(manifestation);
378394
setNewestLastModified.accept(digitalObject, manifestation);
379395

0 commit comments

Comments
 (0)