imports and better error reporting and stacktraces
This commit is contained in:
1 parent
15fe9c5ad9
commit
1650f3233b
15 files changed
+351
-245
No files matched your search
@@ -1,9 +1,28 @@
|
||||
package carpet.script.exception;
|
||||
|
||||
public class CarpetExpressionException extends ExpressionException
|
||||
import carpet.script.value.FunctionValue;
|
||||
import carpet.utils.Messenger;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CarpetExpressionException extends RuntimeException
|
||||
{
|
||||
public CarpetExpressionException(String message)
|
||||
public List<FunctionValue> stack;
|
||||
|
||||
public CarpetExpressionException(String message, List<FunctionValue> stack)
|
||||
{
|
||||
super(message);
|
||||
this.stack = stack;
|
||||
}
|
||||
public void printStack(ServerCommandSource source)
|
||||
{
|
||||
if (stack != null && !stack.isEmpty())
|
||||
{
|
||||
for (FunctionValue fun : stack)
|
||||
{
|
||||
Messenger.m(source, "e ... in "+fun.fullName(), "e /"+(fun.getToken().lineno+1)+":"+(fun.getToken().linepos+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user