A better error message when accessing missing methods
Closed this issue · 3 comments
eight04 commented
https://ianchi.github.io/ESpression-tester/
Context
{"a": 1}
Expression
a.match()
Parsed AST
"can't access property \"apply\", s is undefined"
Two problems:
- It would be nice to have a better error message e.g.
can't call function, a.match is undefined
. - Why changing context would affect parsed AST? I thought it is only used while evaluating the expression.
eight04 commented
Also other null-accessing errors e.g. null[0]
, null.a
.
ianchi commented
Hi, effectively the context doesn't affect the parsing.
This is an error on the tester app, that is showing the eval error on the AST textbox.
I'll fix it asap.
ianchi commented
Updated ESpression-tester app, and slightly improved error message