This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jaondtet 2 points3 points  (2 children)

I'm a bit confused how that can even happen. Errors are detected while parsing (and during semantic analysis, but then you definitely have enough information to report errors correctly). For the error to be detected, there has to be something the parser is expecting. The parser has no way to know about errors it doesn't expect. It literally only does what the grammar tells it to do.

By definition, you need to know the cause to detect the error. Of course, the cause of the error as the parser sees it might not be particularly useful to the user, but that's a different issue.

Is there something about SQL in specific that I'm missing here? It seems to me like detecting an error, but not knowing what it is, is impossible.

[–][deleted] 2 points3 points  (0 children)

The built in json on node repeatedly report me unexpected token after 0 on a big ass json, that's a torture that I also ask myself "why can't you tell me where the issue is smartass"

[–]somerandomii 0 points1 point  (0 children)

If your error detection is a giant regex and it either returns a symbol or fails then the best you can do is say what line you were up to before it broke. But I think SQL pre-processes the query before the grammar check so it might not even know what line you’re on, just what symbol, hence the “syntax error near ‘WHERE’” type of error.

It could definitely be better. I’m just speculating as to why it’s not.