private void ThrowInvalidOperandError(string operatorLexeme, ItemType firstType, ItemType secondType) { string message = string.Empty; if (firstType == secondType) { message = string.Format(InvalidOperatorInExpression, operatorLexeme, firstType.GetFriendlyName()); } else { message = string.Format(InvalidOperandsInExpression, operatorLexeme, firstType.GetFriendlyName(), secondType.GetFriendlyName()); } throw new ExpressionException(message); }