Skip to content

Commit f339da1

Browse files
committed
Fix test compatibility: Restore backward-compatible error message format
The improved error messages from Phase 4 changed the format from: 'Given index is not found.' To: 'Cannot erase index X: not found in tree (tree size: Y)' Tests expected the old format substring 'Given index is not found'. SOLUTION: Restore backward-compatible format while keeping Phase 4 improvements: 'Given index is not found. (Index: X, tree size: Y)' This maintains: ✓ Test compatibility (contains expected substring) ✓ Phase 4 improvements (contextual information) ✓ Better debugging (specific index and tree size shown) All 12 erase error tests now pass.
1 parent da77e67 commit f339da1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cpp/prtree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,10 +1430,10 @@ template <IndexType T, int B = 6, int D = 2> class PRTree {
14301430

14311431
auto it = idx2bb.find(idx);
14321432
if (unlikely(it == idx2bb.end())) {
1433-
// Phase 4: Improved error message with context
1433+
// Phase 4: Improved error message with context (backward compatible)
14341434
throw std::runtime_error(
1435-
"Cannot erase index " + std::to_string(idx) +
1436-
": not found in tree (tree size: " + std::to_string(idx2bb.size()) + ")");
1435+
"Given index is not found. (Index: " + std::to_string(idx) +
1436+
", tree size: " + std::to_string(idx2bb.size()) + ")");
14371437
}
14381438
BB<D> target = it->second;
14391439

0 commit comments

Comments
 (0)