package edu.princeton.toy.lang; /** * TException is an exception passed down internally in the step() function of TVirtualMachine. * It signals one of several types of exception that can occur in the "stricter" virtual TOY * machine. * * @author btsang * @version 7.1 */ public class TException extends Exception { private TExceptionType type; /** * Constructs a new TException object with the given type. */ public TException(TExceptionType type) { if (type == null) throw new NullPointerException(); this.type = type; } /** * Returns the type of this exception. * * @return The type of this exception. This is gauranteed to be non-null. */ public TExceptionType getType() { return type; } }