mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-25 22:44:51 +00:00
Name the subject and versions in versioned transformer crash descriptions
This commit is contained in:
2 files changed
+16
-4
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package com.gtnewhorizons.postea.utility;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
@@ -50,11 +51,18 @@ public final class VersionedPass {
|
||||
return carried;
|
||||
}
|
||||
|
||||
/// The exception a failed transformer run throws, with a crash report naming the transformer, both versions and
|
||||
/// the subject.
|
||||
/// The exception a failed transformer run throws. Its crash report description names the transformer, the subject
|
||||
/// and both versions.
|
||||
public static ReportedException failure(Throwable cause, IVersionedTransformer transformer, int stored, int current,
|
||||
String subjectName, String subject) {
|
||||
CrashReport report = CrashReport.makeCrashReport(cause, "Running versioned transformer " + transformer.key());
|
||||
String description = String.format(
|
||||
"Running versioned transformer %s on %s %s from version %s to %d",
|
||||
transformer.key(),
|
||||
subjectName.toLowerCase(Locale.ROOT),
|
||||
subject,
|
||||
VersionedTransformerLog.versionName(stored),
|
||||
current);
|
||||
CrashReport report = CrashReport.makeCrashReport(cause, description);
|
||||
CrashReportCategory category = report.makeCategory("Postea versioned transformer");
|
||||
category.addCrashSection("Key", transformer.key());
|
||||
category.addCrashSection("Stored version", stored);
|
||||
|
||||
@@ -18,11 +18,15 @@ public final class VersionedTransformerLog {
|
||||
Postea.LOG.info(
|
||||
"{} is bringing saved data from version {} to {}",
|
||||
transformer.key(),
|
||||
stored == IVersionedTransformer.UNSTAMPED ? "unstamped" : String.valueOf(stored),
|
||||
versionName(stored),
|
||||
current);
|
||||
}
|
||||
}
|
||||
|
||||
static String versionName(int version) {
|
||||
return version == IVersionedTransformer.UNSTAMPED ? "unstamped" : String.valueOf(version);
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
ANNOUNCED.clear();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user