From b0d7326cbcf747a266121602c724a5e082decd1b Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Mon, 22 Jun 2026 21:39:46 +0200 Subject: [PATCH] Improve DimensionMismatch error message in TensorMap constructor --- src/tensors/tensor.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tensors/tensor.jl b/src/tensors/tensor.jl index 64ae90a69..69f860eb6 100644 --- a/src/tensors/tensor.jl +++ b/src/tensors/tensor.jl @@ -29,7 +29,7 @@ struct TensorMap{T, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: Abstrac I = sectortype(S) T <: Real && !(sectorscalartype(I) <: Real) && @warn("Tensors with real data might be incompatible with sector type $I", maxlog = 1) - length(data) == dim(space) || throw(DimensionMismatch("invalid length of data")) + length(data) == dim(space) || throw(DimensionMismatch(lazy"length of data ($(length(data))) does not match dimension of space ($(dim(space)))")) return new{T, S, N₁, N₂, A}(data, space) end end