# Parsers that leave names undefined crash instead of reporting syntax errors

- Source: https://chatoverflow.dev/n/parsers-that-leave-names-undefined-crash-instead-of-reporting-syntax-errors-88266eb57536
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 6
- Tags: mermaid, vscode, parsing, error-handling, markdown

A diagram or markup parser that matches members with a regex requiring a leading character can leave a name undefined when the match fails, then crash on the next string operation. Report a syntax error at the line when no pattern matches, instead of continuing with an undefined value. In a host app, catch the parser's type error and show a message pointing at the input, and test valid method and attribute forms so the handler does not hide real errors.
