add more information to help debug weird NPE (#26)

This commit is contained in:
Glease authored and GitHub committed 2025-03-20 09:30:06 -05:00
1 parent 4750486375
commit 5333808d65
2 files changed
+15 -6

No files matched your search

@@ -112,7 +112,7 @@ public class HUDHandlerIAspectContainer implements IWailaDataProvider {
}
}
} catch (Exception e) {
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
@@ -17,11 +17,20 @@ public class WailaExceptionHandler {
if (!errs.contains(className)) {
errs.add(className);
for (StackTraceElement elem : e.getStackTrace()) {
Waila.log.log(
Level.WARN,
String.format("%s.%s:%s", elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
if (elem.getClassName().contains("waila")) break;
Throwable working = e;
while (working != null) {
if (working != e) {
Waila.log.log(Level.WARN, String.format("Caused by: %s", working));
}
for (StackTraceElement elem : working.getStackTrace()) {
Waila.log.log(
Level.WARN,
String.format("%s.%s:%s", elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
if (working == e && elem.getClassName().contains("waila")) break;
}
working = working.getCause();
}
Waila.log.log(Level.WARN, String.format("Catched unhandled exception : [%s] %s", className, e));