Skip to content

Commit

Permalink
#5813 Improve exception text on grouping by invalid column name
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Smirnov committed May 28, 2021
1 parent e5f5eeb commit d431028
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.Data.Analysis/DataFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public GroupBy GroupBy(string columnName)
{
int columnIndex = _columnCollection.IndexOf(columnName);
if (columnIndex == -1)
throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName));
throw new ArgumentException(String.Format(Strings.InvalidColumnName, columnName), nameof(columnName));

DataFrameColumn column = _columnCollection[columnIndex];
return column.GroupBy(columnIndex, this);
Expand Down Expand Up @@ -573,7 +573,7 @@ public DataFrame Append(IEnumerable<KeyValuePair<string, object>> row, bool inPl
int index = ret.Columns.IndexOf(columnName);
if (index == -1)
{
throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName));
throw new ArgumentException(String.Format(Strings.InvalidColumnName, columnName), nameof(columnName));
}

DataFrameColumn column = ret.Columns[index];
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public DataFrameColumn this[string columnName]
int columnIndex = IndexOf(columnName);
if (columnIndex == -1)
{
throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName));
throw new ArgumentException(String.Format(Strings.InvalidColumnName, columnName), nameof(columnName));
}
return this[columnIndex];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Data.Analysis/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<value>Inconsistent null bitmaps and NullCounts</value>
</data>
<data name="InvalidColumnName" xml:space="preserve">
<value>Column does not exist</value>
<value>Column '{0}' does not exist</value>
</data>
<data name="InvalidFieldWidths" xml:space="preserve">
<value>All field widths, except the last element, must be greater than zero. A field width less than or equal to zero in the last element indicates the last field is of variable length.</value>
Expand Down

0 comments on commit d431028

Please sign in to comment.