Skip to content

Commit 0485290

Browse files
authored
cf: when "no matching files found" include retrieved filenames in error (#557)
1 parent 3e6860f commit 0485290

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/java/me/itzg/helpers/curseforge/CurseForgeApiClient.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import java.time.Duration;
1010
import java.util.Collection;
1111
import java.util.HashMap;
12+
import java.util.List;
1213
import java.util.Map;
14+
import java.util.stream.Collectors;
1315
import lombok.extern.slf4j.Slf4j;
1416
import me.itzg.helpers.cache.ApiCaching;
1517
import me.itzg.helpers.curseforge.model.Category;
@@ -174,19 +176,25 @@ public CurseForgeFile resolveModpackFile(
174176
.toObject(GetModFilesResponse.class)
175177
.execute();
176178

177-
return resp.getData().stream()
179+
final List<CurseForgeFile> files = resp.getData();
180+
181+
return files.stream()
178182
.filter(file ->
179183
// even though we're preparing a server, we need client modpack to get deterministic manifest layout
180184
!file.isServerPack() &&
181185
(fileMatcher == null || file.getFileName().contains(fileMatcher)))
182186
.findFirst()
183187
.orElseThrow(() -> {
188+
final String names = files.stream()
189+
.map(CurseForgeFile::getFileName)
190+
.collect(Collectors.joining(","));
191+
184192
log.debug("No matching files for mod id={} name={} trying fileMatcher={}, sample of latest files={}",
185193
mod.getId(), mod.getName(),
186194
fileMatcher, mod.getLatestFiles()
187195
);
188-
return new GenericException(String.format("No matching files found for mod '%s' (%d) using fileMatcher '%s'",
189-
mod.getSlug(), mod.getId(), fileMatcher)
196+
return new GenericException(String.format("No matching files found for mod '%s' (%d) using fileMatcher '%s': %s",
197+
mod.getSlug(), mod.getId(), fileMatcher, names)
190198
);
191199
});
192200
}

0 commit comments

Comments
 (0)