More crash reporting tweaks. Don't crash when trying to show warnings. Also, put the exception name in the error screen on the second line!

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2020-09-09 19:04:05 -04:00
parent c382527ba2
commit 9f3141ea16
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
2 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ public class ForgeI18n {
customFactories.put("lower", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toLowerCase(String.valueOf(objectToParse)))));
// {0,upper> -> uppercase supplied string
customFactories.put("upper", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> stringBuffer.append(StringUtils.toUpperCase(String.valueOf(objectToParse)))));
// {0,exc,class} -> class of exception; {0,exc,msg} -> message from exception
// {0,exc,cls} -> class of exception; {0,exc,msg} -> message from exception
customFactories.put("exc", (name, formatString, locale) -> new CustomReadOnlyFormat((stringBuffer, objectToParse) -> parseException(formatString, stringBuffer, objectToParse)));
// {0,vr} -> transform VersionRange into cleartext string using fml.messages.version.restriction.* strings
customFactories.put("vr", (name, formatString, locale) -> new CustomReadOnlyFormat(((stringBuffer, o) -> MavenVersionStringHelper.parseVersionRange(formatString, stringBuffer, o))));
@ -72,9 +72,9 @@ public class ForgeI18n {
private static void parseException(final String formatString, final StringBuffer stringBuffer, final Object objectToParse) {
Throwable t = (Throwable) objectToParse;
if (Objects.equals(formatString, "msg")) {
stringBuffer.append(t.getMessage());
stringBuffer.append(t.getClass().getName()).append(": ").append(t.getMessage());
} else if (Objects.equals(formatString, "cls")) {
stringBuffer.append(t.getClass());
stringBuffer.append(t.getClass().getName());
}
}

View File

@ -66,7 +66,7 @@ public class LoadingErrorScreen extends ErrorScreen {
this.modLoadErrors = loadingException == null ? Collections.emptyList() : loadingException.getErrors();
this.modsDir = FMLPaths.MODSDIR.get();
this.logFile = FMLPaths.GAMEDIR.get().resolve(Paths.get("logs","latest.log"));
this.dumpedLocation = dumpedLocation.toPath();
this.dumpedLocation = dumpedLocation != null ? dumpedLocation.toPath() : null;
}
@Override