Fixed error reporting in REPL
This commit is contained in:
parent
21738b9382
commit
15ec8dce54
|
@ -42,10 +42,13 @@ proc print*(exc: CompileError) =
|
|||
## Prints a formatted error message
|
||||
## for compilation errors to stderr
|
||||
var file = exc.file
|
||||
if file notin ["<string>", ""]:
|
||||
var contents: string
|
||||
if file notin ["<string>", "", "stdin"]:
|
||||
file = relativePath(exc.file, getCurrentDir())
|
||||
printError(file, readFile(file).splitLines()[exc.line - 1].strip(chars={'\n'}),
|
||||
exc.line, exc.node.getRelativeBoundaries(), exc.function,
|
||||
contents = readFile(file).splitLines()[exc.line - 1].strip(chars={'\n'})
|
||||
else:
|
||||
contents = ""
|
||||
printError(file, contents, exc.line, exc.node.getRelativeBoundaries(), exc.function,
|
||||
exc.msg)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue