summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/system/indexerrors.nim3
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)