Skip to content

Commit 78035e1

Browse files
authored
Match base julia error messages for hvcat (#588)
1 parent c8dd8ad commit 78035e1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/sparsevector.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,15 @@ function hvcat_internal(rows::Tuple{Vararg{Int}}, X1::_SparseConcatGroup, X::_Sp
12431243
if anysparse(X1) || anysparse(X...)
12441244
vcat(_hvcat_rows(rows, X1, X...)...)
12451245
else
1246+
# Needed to match error type with Base Julia. See https://github.com/JuliaLang/julia/pull/56543#issuecomment-2508637550
1247+
matrix_len = if length(rows) == 0
1248+
0
1249+
else
1250+
length(rows) * rows[1]
1251+
end
1252+
if matrix_len != 1 + length(X)
1253+
throw(ArgumentError("argument count does not match specified shape (expected $matrix_len, got $(1+length(X)))"))
1254+
end
12461255
Base.typed_hvcat(Base.promote_eltypeof(X1, X...), rows, X1, X...)
12471256
end
12481257
end

0 commit comments

Comments
 (0)