diff options
author | Miran <narimiran@disroot.org> | 2019-06-11 14:34:21 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-06-11 14:34:21 +0200 |
commit | b3d2cd738a59aa07eea7cb69e944c7db9eed6a86 (patch) | |
tree | ab10e6ea75ffffb2b3c2a5f990e0140cde946948 /lib/system | |
parent | 639e9a7aa9bed6d2379820e64f3b112241843be2 (diff) | |
download | Nim-b3d2cd738a59aa07eea7cb69e944c7db9eed6a86.tar.gz |
[other] better error message for IndexError for empty containers (#11476)
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/indexerrors.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/system/indexerrors.nim b/lib/system/indexerrors.nim index 53c52a26a..1b91789bd 100644 --- a/lib/system/indexerrors.nim +++ b/lib/system/indexerrors.nim @@ -4,7 +4,8 @@ template formatErrorIndexBound*[T](i, a, b: T): string = when defined(standalone): "indexOutOfBounds" else: - "index " & $i & " not in " & $a & " .. " & $b + 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) |