This project has moved and is read-only. For the latest updates, please go here.

using v8 with : compile javascript and know for any possible error before executing

May 13, 2015 at 12:15 PM
I am using C# .Net, ClearScript for v8 JavaScript work.
I need to check for possible errors (whatever possible) in javascript before i execute it.
I have checked that there are [.Compile], [.Execute] and [.Evaluate] functions.
But I want to know that how i can check javascript possible error first before executing it.
Is this possible. Please help me out.
May 13, 2015 at 1:03 PM
Edited May 13, 2015 at 1:24 PM
Hi RavinWorx,

Consider using a JavaScript parsing library. Esprima is one that's written in JavaScript.

Edit: Note that a parsing library is useful if you need to perform semantic analysis of any kind. The ClearScript methods you mentioned all throw exceptions if the code contains syntax errors.

Good luck!