Closed
Description
Error output produced by raise newException
is inconsistent with other IO such as echo
or stdout.write
.
Example
const b_null: char = 0.char
var msg = "This char is `" & $b_null & "` and works fine!"
echo msg
raise newException(Exception, msg)
Current Output
echo msg
# This char is `` and works fine!
raise newException(Exception, msg)
# Error: unhandled exception: This char is `
Expected Output
echo msg
# This char is `` and works fine!
raise newException(Exception, msg)
# Error: unhandled exception: This char is `` and works fine! [Exception]
Additional Information
- This issue was found via fuzzing some CLI utility, which takes piped input. The error messsage was being cutoff, because the input contained a NULL byte.
EDIT: - Consistency is the main thing I'd ask for, however, if both could output
^@
for NULL char, that may be better assuming it doesn't introduce needless complexity.
$ nim -v
Nim Compiler Version 1.0.4 [Linux: amd64]
Compiled at 2019-11-27
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: c8998c498f5e2a0874846eb31309e1d1630faca6
active boot switches: -d:release