indexerrors.nim 387 B

123456789101112
  1. # imported by other modules, unlike helpers.nim which is included
  2. template formatErrorIndexBound*[T](i, a, b: T): string =
  3. when defined(standalone):
  4. "indexOutOfBounds"
  5. else:
  6. if b < a: "index out of bounds, the container is empty"
  7. else: "index " & $i & " not in " & $a & " .. " & $b
  8. template formatErrorIndexBound*[T](i, n: T): string =
  9. formatErrorIndexBound(i, 0, n)