Initially this error message was introduced to be used in the following scenario:
MessageBox.Show(GeneralException.GetErrorText(Errors.CanNotFindFile) + context.FileName, GlobalParams.Info.Title);
So, there is no easy way to do what you need.
My suggestion is to create your own Exception class like this (did not test it):
public class ExternalFileNotFoundException : MathException
{
public override string Message
{
get
{
return GeneralException.GetErrorText(Errors.CanNotFindFile) + base.Element.Text.Replace(Symbols.StringChar, String.Empty);
}
}
public ExternalFileNotFoundException(Term Variable)
: base(Errors.CanNotFindFile, Variable)
{
}
}
May be I need to include this class directly into SMath Studio. What do you think?