From b57af41e0f1d3201c3b1910fc3269f7cbafc527e Mon Sep 17 00:00:00 2001 From: Spencer Russell Date: Wed, 12 Jul 2023 22:38:34 -0400 Subject: [PATCH] more descriptive error message for `only` --- src/abstractdataframe/abstractdataframe.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/abstractdataframe/abstractdataframe.jl b/src/abstractdataframe/abstractdataframe.jl index 9dc47849a..af631da7d 100644 --- a/src/abstractdataframe/abstractdataframe.jl +++ b/src/abstractdataframe/abstractdataframe.jl @@ -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