summary refs log blame commit diff stats
path: root/lib/system/indexerrors.nim
blob: 1b91789bd708b5149f9dcc9b2905ee48c2e79f87 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                                                 
                                                        


                           

                                                           

                                                     
                                
# imported by other modules, unlike helpers.nim which is included

template formatErrorIndexBound*[T](i, a, b: T): string =
  when defined(standalone):
    "indexOutOfBounds"
  else:
    if b < a: "index out of bounds, the container is empty"
    else: "index " & $i & " not in " & $a & " .. " & $b

template formatErrorIndexBound*[T](i, n: T): string =
  formatErrorIndexBound(i, 0, n)