catch eval exception (CompilationErrorsException) using js

Hi all,

I would like to validate a JSON formatted string using javascript.
The string can be validated using “eval” method, I get thus a hashtable if it is well formatted and a CompilationErrorsException else.

I would like to catch this exception and make some treatment in the “catch statement”.

Does anyone know any solution to this ?

I am not able to use try-catch with javascript, is it really impossible ?

Thanks

Hi, welcome to the forum!

A try…catch construct will be available in the version of JS that comes with Unity 3.0.

It’s already available in JS, probably since the 1.x days.

–Eric