Package net.minecraftforge.logging
Class CrashReportAnalyser
java.lang.Object
net.minecraftforge.logging.CrashReportAnalyser
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
analyseCrashReport
(Throwable throwable, StackTraceElement[] uncategorizedStackTrace) Tries to analyze the given exception and uncategorized stacktrace of the crash report.static String
appendSuspectedMods
(Throwable throwable, StackTraceElement[] uncategorizedStackTrace) Tries to cache, analyze and append the suspected mods for this crash to the crash report.private static void
blameIfPresent
(StackTraceElement stackTraceElement) private static void
blameIfPresent
(String className, String... position) private static void
buildSuspectedModsSection
(StringBuilder stringBuilder) Converts the suspected mod(s) for this crash to a String to be added to the crash report, including the mods name, its id, version and an issues link if available, as well as the position where the exception occurred (either the stacktrace element or the mixin class and its target(s))private static void
Iterates over all loaded mods, resolving and caching their package names with the correspondingIModInfo
.private static String
findMatchingPackage
(String className) Checks if the beginning of the given class name is contained in thePACKAGE_MOD_CACHE
private static org.spongepowered.asm.mixin.transformer.meta.MixinMerged
findMixinMerged
(StackTraceElement element) private static org.spongepowered.asm.mixin.extensibility.IMixinInfo
getMixinInfo
(StackTraceElement element) Tries to identify any applied mixin for the class and method provided by the stacktrace element.private static void
identifyByClass
(StackTraceElement stackTraceElement) private static void
identifyByMixins
(StackTraceElement stackTraceElement) private static void
scanStacktrace
(StackTraceElement[] stackTrace) Checks the given stacktrace for any occurrence of the package names cached in thePACKAGE_MOD_CACHE
, including mixin classes.private static void
scanThrowable
(Throwable throwable) Checks the stacktrace of the given throwable and all its children for any occurrence of the package names cached in thePACKAGE_MOD_CACHE
, including mixin classes.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
PACKAGE_MOD_CACHE
-
SUSPECTED_MODS
-
-
Constructor Details
-
CrashReportAnalyser
private CrashReportAnalyser()
-
-
Method Details
-
appendSuspectedMods
public static String appendSuspectedMods(Throwable throwable, StackTraceElement[] uncategorizedStackTrace) Tries to cache, analyze and append the suspected mods for this crash to the crash report. -
analyseCrashReport
private static void analyseCrashReport(Throwable throwable, StackTraceElement[] uncategorizedStackTrace) Tries to analyze the given exception and uncategorized stacktrace of the crash report. It checks the stacktrace for any occurrence of the package names cached in thePACKAGE_MOD_CACHE
, including mixin classes. -
buildSuspectedModsSection
Converts the suspected mod(s) for this crash to a String to be added to the crash report, including the mods name, its id, version and an issues link if available, as well as the position where the exception occurred (either the stacktrace element or the mixin class and its target(s)) -
scanThrowable
Checks the stacktrace of the given throwable and all its children for any occurrence of the package names cached in thePACKAGE_MOD_CACHE
, including mixin classes. -
scanStacktrace
Checks the given stacktrace for any occurrence of the package names cached in thePACKAGE_MOD_CACHE
, including mixin classes. -
cacheModList
private static void cacheModList()Iterates over all loaded mods, resolving and caching their package names with the correspondingIModInfo
. -
identifyByClass
-
identifyByMixins
-
blameIfPresent
-
blameIfPresent
-
findMatchingPackage
Checks if the beginning of the given class name is contained in thePACKAGE_MOD_CACHE
- Returns:
- the package name of the class or null if it is not present in the cache
-
findMixinMerged
@Nullable private static org.spongepowered.asm.mixin.transformer.meta.MixinMerged findMixinMerged(StackTraceElement element) -
getMixinInfo
@Nullable private static org.spongepowered.asm.mixin.extensibility.IMixinInfo getMixinInfo(StackTraceElement element) Tries to identify any applied mixin for the class and method provided by the stacktrace element.- Parameters:
element
- the stacktrace element to check- Returns:
- the
IMixinInfo
for the class and method or null if there is no mixin applied at this position
-