Jint 2/ECMAScript error messages are a little lacking

241 Views Asked by At

I'm in the process of modifying the Jint 2.0.0 javascript engine to my bidding, but I'm discovering that there's a severe lack of error messages to return to the user. My application must be usable by beginners to JS so I really want to be able to give good feedback on any mistakes.

The documentation for Jint is, well, minimal and I've checked out the ECMAScript specification and they don't provide anything helpful either. See this PutValue example. It simply specifies that at a giving point:

"Throw ReferenceError exception."

Which is totally unhelpful.

I had the idea of trying to replicate each possible error in a finished polished ECMAScript implementation like V8 and see what they have, but damn, that sounds like a lot of work. And I risk not getting the whole array of possible return messages for each error.

I'm about to download the V8 source and see if they have a list of error messages stored somewhere obvious. Does any one know if that exists and if so where it is?

Apart from that I'm drawing a blank. Any one got any ideas? I would be extremely grateful for anything at all. Thank you!

1

There are 1 best solutions below

0
On

For anyone looking for this in the future, get the V8 source:

https://code.google.com/p/v8-wiki/wiki/UsingGit

and look in src/messages.js. They're right at the top of the file. You'll have to do a search for the name of the error to find it's place in the source code though. On linux or in cygwin, you can use for example

grep -R 'unexpected_token' .