Skip to content

Commit

Permalink
Add more explicit error 404 messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisszmundy committed May 15, 2024
1 parent 2bf9947 commit 2008c0e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private String readField(JsonNode node, String field) throws MissingMandatoryFie
public Path findDDIFile(Path specDirectory) throws KraftwerkException, IOException {
try (Stream<Path> files = Files.find(specDirectory, 1, (path, basicFileAttributes) -> path.toFile().getName().toLowerCase().matches("ddi[\\w,\\s-]+\\.xml"))) {
return files.findFirst()
.orElseThrow(() -> new KraftwerkException(404, "No DDI file found in " + specDirectory.toString()));
.orElseThrow(() -> new KraftwerkException(404, "No DDI file (ddi*.xml) found in " + specDirectory.toString()));
}
}

Expand All @@ -122,7 +122,7 @@ public Path findDDIFile(Path specDirectory) throws KraftwerkException, IOExcepti
public Path findLunaticFile(Path specDirectory) throws KraftwerkException, IOException {
try (Stream<Path> files = Files.find(specDirectory, 1, (path, basicFileAttributes) -> path.toFile().getName().toLowerCase().matches("lunatic[\\w,\\s-]+\\.json"))) {
return files.findFirst()
.orElseThrow(() -> new KraftwerkException(404, "No Lunatic file found in " + specDirectory.toString()));
.orElseThrow(() -> new KraftwerkException(404, "No Lunatic file (lunatic*.xml) found in " + specDirectory.toString()));
}
}
}

0 comments on commit 2008c0e

Please sign in to comment.