#include <string>
#include "exceptioneval.h"

using namespace std;

const char* ExceptionEval::type="ExceptionEval";

const char* ExceptionEval::getType() const
{
	return type;
}

int ExceptionEval::eval(TclInterp *interp,const string& cmd)
{
	int res=interp->eval(cmd);
	if (res!=TCL_OK)
		throw new ExceptionEval(cmd,interp->getInterp()->result,TclInterp::getCodeName(res));
	return res;
}

const string& ExceptionEval::getMessage() const
{
	string res=string("Expression '")+cmd+"' evaluated and returned ["+retCode+"] :"+result;
	return *(new string(res));
}
