Skip to content

Commit 1c643e2

Browse files
committed
game will now crash if library downloading fails
1 parent 9bb03be commit 1c643e2

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/main/java/com/falsepattern/lib/internal/impl/dependencies/DependencyLoaderImpl.java

+24-20
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,16 @@ private static void executeArtifactLoading(boolean sideAware) {
628628
final var vizThread = getVizThread(doViz, progresses, theFrame);
629629
vizThread.start();
630630
}
631-
theFuture.join();
632-
if (theFrame != null) {
633-
doViz.set(false);
631+
try {
632+
theFuture.join();
633+
} catch (Error e) {
634+
throw e;
635+
} catch (Throwable t) {
636+
throw new Error(t);
637+
} finally {
638+
if (theFrame != null) {
639+
doViz.set(false);
640+
}
634641
}
635642
}
636643

@@ -658,6 +665,7 @@ private static Thread getVizThread(AtomicBoolean doViz, HashMap<DependencyLoadTa
658665
}
659666
theFrame.dispose();
660667
});
668+
vizThread.setDaemon(true);
661669
vizThread.setName("FalsePatternLib Download Visualizer");
662670
return vizThread;
663671
}
@@ -689,26 +697,22 @@ private static class DependencyLoadTask {
689697
public volatile long downloaded = 0;
690698

691699
private void load() {
692-
try {
693-
setupLibraryNames();
694-
if (loadedLibraries.containsKey(artifact)) {
695-
alreadyLoaded();
696-
return;
697-
}
698-
setupPaths();
699-
if (tryLoadingExistingFile()) {
700+
setupLibraryNames();
701+
if (loadedLibraries.containsKey(artifact)) {
702+
alreadyLoaded();
703+
return;
704+
}
705+
setupPaths();
706+
if (tryLoadingExistingFile()) {
707+
return;
708+
}
709+
validateDownloadsAllowed();
710+
for (var repo : mavenRepositories) {
711+
if (tryDownloadFromMaven(repo)) {
700712
return;
701713
}
702-
validateDownloadsAllowed();
703-
for (var repo : mavenRepositories) {
704-
if (tryDownloadFromMaven(repo)) {
705-
return;
706-
}
707-
}
708-
crashCouldNotDownload();
709-
} catch (Exception e) {
710-
LOG.fatal(e);
711714
}
715+
crashCouldNotDownload();
712716
}
713717

714718
private void crashCouldNotDownload() {

0 commit comments

Comments
 (0)