Add a way to display stacktrace of StacklessRuntimeException for debug

This commit is contained in:
altrisi committed 2025-11-26 23:44:15 +01:00
1 parent 505280df73
commit 75a5d4ee12
2 files changed
+11

No files matched your search

@@ -1,5 +1,7 @@
package carpet.script.exception; package carpet.script.exception;
import carpet.script.external.Carpet;
/** /**
* A type of {@link RuntimeException} that doesn't spend time producing and filling a stacktrace * A type of {@link RuntimeException} that doesn't spend time producing and filling a stacktrace
*/ */
@@ -18,6 +20,10 @@ public abstract class StacklessRuntimeException extends RuntimeException
@Override @Override
public Throwable fillInStackTrace() public Throwable fillInStackTrace()
{ {
if (Carpet.isDebugEnabled())
{
return super.fillInStackTrace();
}
return this; return this;
} }
} }
+5
View File
@@ -142,6 +142,11 @@ public class Carpet
return CarpetSettings.fillUpdates; return CarpetSettings.fillUpdates;
} }
public static boolean isDebugEnabled()
{
return CarpetSettings.superSecretSetting;
}
@Nullable @Nullable
public static Module fetchGlobalModule(String name, boolean allowLibraries) throws IOException public static Module fetchGlobalModule(String name, boolean allowLibraries) throws IOException
{ {