Skip to content

How to interpret error objects? #595

Answered by nene
adam-rgare asked this question in Q&A
Apr 26, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hard to reproduce without the exact code that triggers this error, but I suspect this object comes from the parser which in turn refers to the tokens created by the Tokenizer. I personally haven't seen this kind of object being thrown. Normally I would expect some instance of Error class to be thrown, not a plain object.

The token.start property refers to the position in source text where this token starts, in this case the start of "FROM". Where this offset comes from... I have no idea. Perhaps it's the offset of the current token in the array of tokens.

Anyway, to my knowledge there's no clear start/end info inside tokens. So the best you can do is something like:

start = token.start
en…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@adam-rgare
Comment options

@nene
Comment options

Answer selected by adam-rgare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants