aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2023-11-09 10:47:12 +0000
committerArne Juul <arnej@yahooinc.com>2023-11-09 10:47:12 +0000
commitff05a8fd7f067a90826ec19045257fcb897af500 (patch)
treec46a36879f99c663e1c2a993e6c9e814885a9acd /vespajlib/src
parent3956563e17ea78418657f264d8efae93494c7172 (diff)
add more details if validation fails
Diffstat (limited to 'vespajlib/src')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java b/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java
index 5b277e4716f..1d55fa78b83 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/MixedTensor.java
@@ -60,20 +60,29 @@ public class MixedTensor implements Tensor {
this.cellBlocks = List.copyOf(cellBlocks);
this.index = index;
if (this.blockSize < 1) {
- throw new IllegalStateException("invalid dense subspace size " + blockSize);
+ throw new IllegalStateException("invalid dense subspace size: " + blockSize);
}
long count = 0;
for (var block : this.cellBlocks) {
if (index.sparseMap.get(block.sparseAddr) != count) {
- throw new IllegalStateException("map vs list mismatch");
+ throw new IllegalStateException("map vs list mismatch: block #"
+ + count
+ + " address maps to #"
+ + index.sparseMap.get(block.sparseAddr));
}
if (block.cells.length != blockSize) {
- throw new IllegalStateException("block length mismatch");
+ throw new IllegalStateException("dense subspace size mismatch, expected "
+ + blockSize
+ + " cells, but got: "
+ + block.cells.length);
}
++count;
}
if (count != index.sparseMap.size()) {
- throw new IllegalStateException("map vs list size mismatch");
+ throw new IllegalStateException("mismatch: list size is "
+ + count
+ + " but map size is "
+ + index.sparseMap.size());
}
}