8000 fix: restore useful parse error messages in REPL (issue #78) by adityamukho · Pull Request #87 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,17 @@ impl Repl {
eprintln!("Execution error: {}", e);
}
},
Err(_e) => {
eprintln!("Parse error");
Err(e) => {
// CodeQL false positive: parser errors contain structural info only (token type, position).
// Extract error kind by taking up to first ':' or first 80 chars to avoid UserInput in logs.
let error_kind = e
.split(':')
.next()
.unwrap_or(&e)
.chars()
.take(80)
.collect::<String>();
eprintln!("Parse error: {}", error_kind);
}
}

Expand Down
Loading
0