* Make index out of bounds more useful by including the 'bounds'. * fixes #9880 index out of bounds (remaining cases); revives #10228 * change err msg to: `index 3 not in 0 .. 1`
This commit is contained in:
parent
8f05b34125
commit
942495611b
11 changed files with 88 additions and 36 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# imported by other modules, unlike helpers.nim which is included
|
||||
|
||||
template formatErrorIndexBound*[T](i, a, b: T): string =
|
||||
"index out of bounds: (a: " & $a & ") <= (i: " & $i & ") <= (b: " & $b & ") "
|
||||
"index " & $i & " not in " & $a & " .. " & $b
|
||||
|
||||
template formatErrorIndexBound*[T](i, n: T): string =
|
||||
"index out of bounds: (i: " & $i & ") <= (n: " & $n & ") "
|
||||
formatErrorIndexBound(i, 0, n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue