package calculator.interpreter;
import calculator.interpreter.ast.Node;
import net.sf.etl.parsers.SourceLocation;
/**
* The evaluation exception is thrown when there is an semantic evaluation error
* and it makes no sense to show the user the full stack trace.
*/
public class EvalException extends RuntimeException {
/** serial version id */
private static final long serialVersionUID = -2305068700074709931L;
/**
* The constructor
*
* @param node the node that caused the exception
* @param message the error message to show to user
*/
public EvalException(Node node, String message) {
this(node.location, message);
}
/**
* The constructor
*
* @param location the source location that caused the exception
* @param message the error message to show to user
*/
public EvalException(SourceLocation location, String message) {
super(location.toShortString() + ":" + message);
}
}