package dspl.frontend;

import dspl.intermediate.variable.Variable;

public class SymbolicException extends Exception
{
	private static final long serialVersionUID = -4138125106173822122L;
	private String errMsg;
	private Variable var;
	
	public SymbolicException(Variable v, String err)
	{
		super(generateErrorMessage(v, err));
		errMsg = err;
		var = v;
	}
	
	public static String generateErrorMessage(Variable v, String message) {
		if(v != null)
			return "Identifier " + v.getIdentifier() + " : " + message;
		return message;
	}
	
	public void printMessage() {
		System.out.println(generateErrorMessage(var, errMsg));
	}
}
