indexerrors.nim 531 B

12345678910111213141516
  1. # imported by other modules, unlike helpers.nim which is included
  2. # xxx this is now included instead of imported, we should import instead
  3. template formatErrorIndexBound*[T](i, a, b: T): string =
  4. when defined(standalone):
  5. "indexOutOfBounds"
  6. else:
  7. if b < a: "index out of bounds, the container is empty"
  8. else: "index " & $i & " not in " & $a & " .. " & $b
  9. template formatErrorIndexBound*[T](i, n: T): string =
  10. formatErrorIndexBound(i, 0, n)
  11. template formatFieldDefect*(f, discVal): string =
  12. f & discVal & "'"