Skip to content

Commit

Permalink
more descriptive error message for only (#3357)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssfrr authored Jul 13, 2023
1 parent 8ba2288 commit 02d1c99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/abstractdataframe/abstractdataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ If `df` has a single row return it as a `DataFrameRow`; otherwise throw `Argumen
$METADATA_FIXED
"""
function Base.only(df::AbstractDataFrame)
nrow(df) != 1 && throw(ArgumentError("data frame must contain exactly 1 row"))
n = nrow(df)
n != 1 && throw(ArgumentError("data frame must contain exactly 1 row, got $n"))
return df[1, :]
end

Expand Down

0 comments on commit 02d1c99

Please sign in to comment.