Skip to content

Commit 5104faf

Browse files
authored
Improve DimensionMismatch error message in TensorMap constructor (#456)
1 parent 41b1fc9 commit 5104faf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/tensors/tensor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct TensorMap{T, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: Abstrac
2929
I = sectortype(S)
3030
T <: Real && !(sectorscalartype(I) <: Real) &&
3131
@warn("Tensors with real data might be incompatible with sector type $I", maxlog = 1)
32-
length(data) == dim(space) || throw(DimensionMismatch("invalid length of data"))
32+
length(data) == dim(space) || throw(DimensionMismatch(lazy"length of data ($(length(data))) does not match dimension of space ($(dim(space)))"))
3333
return new{T, S, N₁, N₂, A}(data, space)
3434
end
3535
end

0 commit comments

Comments
 (0)