Skip to content

Commit

Permalink
Clean up mod resolution error messages (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meredith Espinosa authored Oct 26, 2020
1 parent 3b7f40f commit 134386b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/net/fabricmc/loader/discovery/ModResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.zip.ZipError;

import static com.google.common.jimfs.Feature.FILE_CHANNEL;
import static com.google.common.jimfs.Feature.SECURE_DIRECTORY_STREAM;
Expand Down Expand Up @@ -168,6 +169,7 @@ public Map<String, ModCandidate> findCompatibleSet(Logger logger, Map<String, Mo
try {
solver.addClause(new VecInt(clause));
} catch (ContradictionException e) {
//TODO: JiJ'd mods don't manage to throw this exception and instead fail silently
throw new ModResolutionException("Could not find required mod: " + mod.getInfo().getId() + " requires " + dep, e);
}
}
Expand Down Expand Up @@ -221,7 +223,10 @@ public Map<String, ModCandidate> findCompatibleSet(Logger logger, Map<String, Mo
}
}

// assume satisfied
// TODO: better error message, have a way to figure out precisely which mods are causing this
if (!problem.isSatisfiable(assumptions)) {
throw new ModResolutionException("Could not resolve mod collection due to an unknown error");
}
int[] model = problem.model();
result = new HashMap<>();

Expand Down Expand Up @@ -578,6 +583,8 @@ protected void compute() {
rootDir = jarFs.get().getRootDirectories().iterator().next();
} catch (IOException e) {
throw new RuntimeException("Failed to open mod JAR at " + path + "!");
} catch (ZipError e) {
throw new RuntimeException("Jar at " + path + " is corrupted, please redownload it!");
}
}

Expand Down

0 comments on commit 134386b

Please sign in to comment.