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;
import carpet.script.external.Carpet;
/**
* 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
public Throwable fillInStackTrace()
{
if (Carpet.isDebugEnabled())
{
return super.fillInStackTrace();
}
return this;
}
}