Add exception hierarchy
This commit is contained in:
13 files changed
+216
-74
No files matched your search
@@ -3,6 +3,7 @@ package carpet.script.value;
|
||||
import carpet.script.CarpetContext;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
import carpet.script.exception.ThrowStatement;
|
||||
import carpet.script.exception.Throwables;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
@@ -75,7 +76,7 @@ public class BlockValue extends Value
|
||||
catch (CommandSyntaxException ignored)
|
||||
{
|
||||
}
|
||||
throw new ThrowStatement("Cannot parse block: "+str, ThrowStatement.UNKNOWN_BLOCK);
|
||||
throw new ThrowStatement("Cannot parse block: "+str, Throwables.UNKNOWN_BLOCK);
|
||||
}
|
||||
|
||||
public static BlockPos locateBlockPos(CarpetContext c, int xpos, int ypos, int zpos)
|
||||
|
||||
@@ -5,6 +5,7 @@ import carpet.script.CarpetContext;
|
||||
import carpet.script.LazyValue;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
import carpet.script.exception.ThrowStatement;
|
||||
import carpet.script.exception.Throwables;
|
||||
import carpet.script.utils.EquipmentInventory;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
@@ -298,7 +299,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
throw new ThrowStatement("Incorrect item: "+itemString, ThrowStatement.UNKNOWN_ITEM);
|
||||
throw new ThrowStatement("Incorrect item: "+itemString, Throwables.UNKNOWN_ITEM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package carpet.script.value;
|
||||
import carpet.fakes.BlockPredicateInterface;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
import carpet.script.exception.ThrowStatement;
|
||||
import carpet.script.exception.Throwables;
|
||||
import carpet.utils.BlockInfo;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
@@ -159,7 +160,7 @@ public class ValueConversions
|
||||
}
|
||||
}
|
||||
if (dim == null)
|
||||
throw new ThrowStatement("Incorrect dimension string: "+dimString, ThrowStatement.UNKNOWN_DIMENSION);
|
||||
throw new ThrowStatement("Incorrect dimension string: "+dimString, Throwables.UNKNOWN_DIMENSION);
|
||||
return server.getWorld(dim);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user