Closed ringabout closed 2 years ago
Neither the assertion nor the IndexError are supposed to be caught anyway so I don't see a problem here. You shall not continue to run your program after a detected bug.
Neither the assertion nor the IndexError are supposed to be caught anyway so I don't see a problem here. You shall not continue to run your program after a detected bug.
Wouldn't it be better to get an assertion failure that works the same on all platform than to get some internal error? I don't think anyone wants to catch the exception.
Exception message: index out of bounds, the container is empty Exception type: [IndexError]
Doesn't this mean there is a bug in stdlib? I forgot to say "test.txt" is not empty.
Full error messages:
/root/prologue/hello.nim(10) hello
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncmacro.nim(262) saveEmpty
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncmacro.nim(29) saveEmptyNimAsyncContinue
/root/prologue/hello.nim(7) saveEmptyIter
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncfile.nim(292) read
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncfile.nim(276) cb
/root/.choosenim/toolchains/nim-#devel/lib/system/fatal.nim(53) sysFatal
[[reraised from:
/root/prologue/hello.nim(10) hello
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncdispatch.nim(1937) waitFor
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncfutures.nim(375) read
]]
Error: unhandled exception: index out of bounds, the container is empty
Async traceback:
/root/prologue/hello.nim(10) hello
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncmacro.nim(262) saveEmpty
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncmacro.nim(29) saveEmptyNimAsyncContinue
/root/prologue/hello.nim(7) saveEmptyIter
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncfile.nim(292) read
/root/.choosenim/toolchains/nim-#devel/lib/pure/asyncfile.nim(276) cb
/root/.choosenim/toolchains/nim-#devel/lib/system/fatal.nim(53) sysFatal
Exception message: index out of bounds, the container is empty
Exception type: [IndexDefect]
Related: #15148
echo "123" >> test.txt
Current Output
in linux
in windows
Expected